npm 错误!代码 UNABLE_TO_GET_ISSUER_CERT_LOCALLY

问题描述:

我正在尝试创建 React 应用程序的所有方法.我已经尝试过 maven,现在我正在尝试使用来自 Facebook Incubators 的 crate-react-app 构建系统.

I am trying all the ways of creating react application. I have tried with maven and now i am trying with crate-react-app build system from Facebook Incubators.

当我尝试在 npm 环境中运行命令 create-react-app my-app 时,它在我的个人系统上运行没有问题.但是当我在我的工作环境中尝试相同的命令时,我在命令提示符下遇到了这个错误

When i tried to run the command create-react-app my-app in npm environment, it worked on my personal system with no issues. But when i tried the same command in my work environment, i have encountered with this error on command prompt

npm ERR! node v6.10.2
npm ERR! npm  v3.10.10
npm ERR! code UNABLE_TO_GET_ISSUER_CERT_LOCALLY

npm ERR! unable to get local issuer certificate
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

网上搜索的一个快速解决方案是 npm config set strict-ssl false,幸运的是它奏效了.但作为我工作环境的一部分,我只能将 strict-ssl 标志设置为 false.

A quick solution from the internet search was npm config set strict-ssl false, luckily it worked. But as a part of my work environment, I am restricted to set the strict-ssl flag to false.

后来我找到了一个安全有效的解决方案,

Later I found a safe and working solution,

npm config set registry http://registry.npmjs.org/  

这很完美,我收到了一条成功消息Happy Hacking!,因为没有将 strict-ssl 标志设置为 false.

this worked perfectly and I got a success message Happy Hacking! by not setting the strict-ssl flag to false.