在WIN10中npm install失败的问题。

在win10中安装淘宝CNPM时出现了这个问题,麻烦大佬们帮忙看下,

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "cnpm" "--registry=https://registry.npm.taobao.org"
npm ERR! node v6.11.5
npm ERR! npm  v3.10.10
npm ERR! code ECONNRESET

npm ERR! network tunneling socket could not be established, cause=getaddrinfo ENOTFOUND � �:80
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly.  See: 'npm help config'

npm ERR! Please include the following file with any support request:
npm ERR!     D:\npm-debug.log
阅读 5.5k
4 个回答

网络的问题吧 开没开翻墙工具

用浏览器打开网址:https://registry.npm.taobao.org,看看是否能得到 JSON 信息。
怀疑你的网络环境有问题,错误描述你的网络设置有问题,可能在代理服务器的后面。

可以使用npm淘宝镜像cnpm安装https://npm.taobao.org/
优点:安装速度快,操作简单
缺点:安装目录有些奇怪,有的包使用cnpm安装后发现提示成功但是无法使用或者没效果(又是找BUG找了半天发现是cnpm安装包问题,巨坑)

也可以直接更换国内源,在使用npm安装,百度搜索“npm换源”即可
优点:安装后使用问题少,比较省心

可以不使用cnpm,安装一个 nrm 模块可以解决的。

# 查看可用源
$ nrm ls

# 使用淘宝源
$ nrm use taobao

以后再使用的时候,直接可以使用 npm install

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题