简体   繁体   English

节点NPM安装 - 500内部服务器错误

[英]Node NPM Install - 500 Internal Server Error

I'm behind a corporate firewall and I wish to use npm to install packages. 我是公司防火墙的后面,我希望使用npm来安装软件包。

Initially when I ran the comand npm install i was getting proxy authentication error. 最初,当我运行命令npm install我收到代理身份验证错误。

I then set the proxy config as below: 然后我将代理配置设置如下:

npm config set proxy http://"ninjadev:5trongP@ssw0rd"@proxy.some-bigcorp.com:PORT

Now I get all i keep getting is 500 internal server error. 现在我得到的所有我不断得到的是500内部服务器错误。 See example below: 见下面的例子:

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

Any ideas? 有任何想法吗?

I faced the exact same issue and spend sometime to figure it out by testing from my lab network and personal network. 我遇到了完全相同的问题,并花了一些时间通过我的实验室网络和个人网络进行测试来弄明白。

From corporate network sometimes you won't be able to properly resolve registry.npmjs.org, as in my case. 从公司网络有时,您将无法正确解析registry.npmjs.org,就像我的情况一样。 Try doing a nslookup registry.npmjs.org. 尝试做一个nslookup registry.npmjs.org。

To workaround the problem do the following. 要解决此问题,请执行以下操作。

dig registry.npmjs.org @1.1.1.1

Take any of the ip in the output and add to /etc/hosts 获取输出中的任何ip并添加到/ etc / hosts

104.16.16.35 registry.npmjs.org

You should be good to go now. 你现在应该好好去。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM