NPM模块安装错误

问题描述:

我在尝试在 node.js 中安装模块时收到错误:无法建立隧道套接字,cause=getaddrinfo ENOTFOUND.似乎有些代理错误.我检查了浏览器设置,代理被禁用.但是当我检查命令提示符 npm config get proxy 时,得到 192.168.98.5:8080.如何禁用此功能?

I am getting Error: tunneling socket could not be established, cause=getaddrinfo ENOTFOUND while trying to install a module in node.js. 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. How to disable this?

首先尝试执行npm config delete proxy.如果您收到类似 Error: ENOENT, unlink '/Users/drlazor/.npmrc' 的信息,就可以了;这意味着您没有 npm 配置文件,因此没有代理设置.

First, try to execute npm config delete proxy. If you get something like Error: ENOENT, unlink '/Users/drlazor/.npmrc' is OK; that means you don't have a npm config file and, therefore, no proxy settings.

其次,使用 npm config get proxy 验证您没有代理设置.您应该得到 null 或上述错误.如果你不断得到不同于 null 的结果,你还应该确保你没有设置环境变量 HTTP_PROXY.

Second, verify you have no proxy settings with npm config get proxy. You should get a nullor the above error. If you keep on getting a result different from null, you should also ensure you haven't set the environment variable HTTP_PROXY.

第三个也是最后一个,如果这些都不起作用,请尝试从浏览器访问 URL;毕竟可能是网络问题.

Third and last, if none of those worked, try accessing the URL from your browser; it could be a network issue after all.