npm安装cnpm报错

查看:636
本文介绍了npm安装cnpm报错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

1.安装cnpm报错:

➜  ~ sudo npm install -g cnpm --registry=https://registry.npm.taobao.org/
npm WARN deprecated minimatch@1.0.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
/usr/local/lib
└── (empty)

npm ERR! Darwin 15.5.0
npm ERR! argv "/usr/local/Cellar/node/6.2.2/bin/node" "/usr/local/bin/npm" "install" "-g" "cnpm" "--registry=https://registry.npm.taobao.org/"
npm ERR! node v6.2.2
npm ERR! npm  v3.10.3
npm ERR! path /usr/local/lib/node_modules/.staging/abbrev-cf0db83f
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/abbrev-cf0db83f' -> '/usr/local/lib/node_modules/cnpm/node_modules/npm/node_modules/abbrev'
npm ERR! enoent ENOENT: no such file or directory, rename '/usr/local/lib/node_modules/.staging/abbrev-cf0db83f' -> '/usr/local/lib/node_modules/cnpm/node_modules/npm/node_modules/abbrev'
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!     /Users/allen/npm-debug.log
npm ERR! code 1
➜  ~ 

2.请问如何解决这个问题:

npm WARN deprecated minimatch@1.0.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

我试过uninstall minimatch@1.0.0和install minimatch@3.0.2,还是提示这个问题

3.npm ERR!那部分报错信息是具体是指什么问题?如何解决?

多谢各位技术大大指点。

解决方案

npm set registry https://registry.npm.taobao.org # 注册模块镜像
npm set disturl https://npm.taobao.org/dist # node-gyp 编译依赖的 node 源码镜像
npm cache clean # 清空缓存

试试这个,这个方法我用了1年多了。

这篇关于npm安装cnpm报错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆