[英]NPM module installation error
I am getting Error: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND while trying to install a module in node.js. 我收到错误:无法建立隧道套接字,尝试在node.js中安装模块时导致= getaddrinfo ENOTFOUND It seems some proxy error.I checked in browser setting ,proxy is disabled.
这似乎是一些代理错误。我在浏览器设置中检查,代理被禁用。 But when i am checking in command prompt npm config get proxy, getting 192.168.98.5:8080.
但是当我在命令提示符下检查npm config get proxy时,得到192.168.98.5:8080。 How to disable this?
如何禁用此功能?
First, try to execute npm config delete proxy
. 首先,尝试执行
npm config delete proxy
。 If you get something like Error: ENOENT, unlink '/Users/drlazor/.npmrc'
is OK; 如果您得到类似
Error: ENOENT, unlink '/Users/drlazor/.npmrc'
; that means you don't have a npm config file and, therefore, no proxy settings. 这意味着您没有npm配置文件,因此没有代理设置。
Second, verify you have no proxy settings with npm config get proxy
. 其次,使用
npm config get proxy
验证您没有代理设置。 You should get a null
or the above error. 你应该得到一个
null
或上面的错误。 If you keep on getting a result different from null
, you should also ensure you haven't set the environment variable HTTP_PROXY
. 如果继续获得与
null
不同的结果,则还应确保未设置环境变量HTTP_PROXY
。
Third and last, if none of those worked, try accessing the URL from your browser; 第三个也是最后一个,如果这些都不起作用,请尝试从浏览器访问URL; it could be a network issue after all.
毕竟这可能是一个网络问题。
Note: This Works if you are not behind a Proxy ie (From a Personal Computer)
注意:如果您不在代理之后,则可以使用此工作,即(从个人计算机)
First execute this command 首先执行此命令
npm config edit
npm the configuration file opens comment following two lines in the opened file by putting ";"(semi Colon) in start of the line.
npm配置文件在打开的文件中的两行后面打开注释,在行的开头加上“;”(半冒号) 。
npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080
You are done. 你完成了。 Now install any package you want to.
现在安装你想要的任何包。
npm install -g cordova
npm install -g npm
or anything else you need to install 或者你需要安装的任何其他东西
i was in the same state and got this error because of the wrong proxy value format (i just miss "http://" at the beginning of the proxies values). 我处于相同的状态并因为错误的代理值格式而得到此错误(我只是在代理值的开头处错过了“http://”)。
If a proxy should be set, here is the format (values depend of your network) : 如果应设置代理,则格式(值取决于您的网络):
npm config set proxy http://proxy.mydomain:3128
npm config set proxy http://proxy.mydomain:3128
npm config set https-proxy http://proxy.mydomain:3128
npm config set https-proxy http://proxy.mydomain:3128
This can also happen if your NPM is configured to use a different NPM registry server (possibly you are on a work machine and not connected to the network/VPN). 如果您的NPM配置为使用不同的NPM注册表服务器(可能您在工作计算机上而未连接到网络/ VPN),也会发生这种情况。 To see if this is the case:
要查看是否是这种情况:
npm config edit
and look for: 并寻找:
registry=http://alternateurl
The default is: 默认为:
https://registry.npmjs.org/
You can connect to your VPN/network or change that config to correct. 您可以连接到您的VPN /网络或更改该配置以进行更正。
You need to set all 3 proxy 您需要设置所有3个代理
npm config set proxy http://proxy.name.xx:port
npm config set http-proxy http://proxy.name.xx:port
npm config set https-proxy http://proxy.name.xx:port
If you have no proxy use the following commands: 如果您没有代理,请使用以下命令:
npm config delete https-proxy
npm config delete proxy
if you are using a proxy use: 如果您使用代理使用:
npm config set proxy $PROXY
npm config set http-proxy $PROXY
Either of the two tend to work 这两者中的任何一个都倾向于工作
In case setting proxy via terminal or creating .npmrc does not help, try to put .typingsrc file in c:\\Users\\'username' with the following content 如果通过终端设置代理或创建.npmrc没有帮助,请尝试将.typingsrc文件放在c:\\ Users \\'username'中,其中包含以下内容
{
"proxy": "http://proxy.name.xx:port",
"https-proxy": "http://proxy.name.xx:port",
"strict-ssl": false
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.