我在公司防火墙后面,我希望使用 npm 安装包。
最初,当我运行命令和 npm install
时,出现了代理身份验证错误。
然后我如下设置代理配置:
npm config set proxy http://"ninjadev:5trongP@ssw0rd"@proxy.some-bigcorp.com:PORT
现在我得到的只是 500 个内部服务器错误。请参见下面的示例:
npm : npm ERR! code E500
At line:1 char:1
+ npm install
+ ~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (npm ERR! code E500:String) [],
RemoteException
+ FullyQualifiedErrorId : NativeCommandError
npm
ERR!
500 Internal Server Error: node-sass@^4.5.3
有什么想法吗?
最佳答案
我遇到了完全相同的问题,并花了一些时间通过对我的实验室网络和个人网络进行测试来解决这个问题。
有时您无法从公司网络正确解析 registry.npmjs.org,就像我的情况一样。尝试执行 nslookup registry.npmjs.org。
要解决此问题,请执行以下操作。
dig registry.npmjs.org @1.1.1.1
获取输出中的任何ip并添加到/etc/hosts
104.16.16.35 registry.npmjs.org
你现在应该可以走了。
关于node.js - Node NPM 安装 - 500 内部服务器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47752318/