npm安装cnpm报错

通过npm安装cnpm,一直提示警告,WARN如下:

npm WARN deprecated socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1

我没有管这个警告,接着向下执行,然后就报错了~,报错信息如下:

npm ERR! Linux 4.15.0-36-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "cnpm" "--registry=https://registry.npm.taobao.org"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! path /usr/local/lib/node_modules/.staging/ansi-regex-5d5795cb
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename

npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/ansi-regex-5d5795cb' -> '/usr/local/lib/node_modules/cnpm/node_modules/npm/node_modules/ansi-regex'
npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/ansi-regex-5d5795cb' -> '/usr/local/lib/node_modules/cnpm/node_modules/npm/node_modules/ansi-regex'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /npm-debug.log

然后我尝试网上找的解决方法:

npm set registry https://registry.npm.taobao.org

npm set disturl https://npm.taobao.org/dist

npm cache clean --force

然后没有解决,我就接着尝试下面的方法:

cnpm install cnpm@5.3.0

安装提示如下:

 Installed 1 packages
✔ Run 0 scripts
deprecate cnpm@5.3.0 › npm-request@1.0.0 › urllib@2.31.2 › proxy-agent@2.3.1 › socks-proxy-agent@3.0.1 › socks@^1.1.10 If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
Recently updated (since 2018-11-21): 4 packages (detail see file /node_modules/.recently_updates.txt)
✔ All packages installed (248 packages installed from npm registry, used 5s(network 5s), speed 2.36MB/s, json 228(451.11kB), tarball 10.19MB)

然后执行cnpm -v,提示如下:

cnpm@6.0.0 (/usr/local/lib/node_modules/cnpm/lib/parse_argv.js)
npm@6.4.1 (/usr/local/lib/node_modules/cnpm/node_modules/npm/lib/npm.js)
node@8.10.0 (/usr/bin/node)
npminstall@3.16.0 (/usr/local/lib/node_modules/cnpm/node_modules/npminstall/lib/index.js)
prefix=/usr/local 
linux x64 4.15.0-36-generic 
registry=https://registry.npm.taobao.org

完美解决问题,感谢各位~

  • 3
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值