node 使用 npm 安装 cnpm 的方法及错误
2019-05-14 21:11
411 查看
cnpm安装
我们可以使用大爱淘宝定制的 cnpm 命令行工具代替默认的 npm
官方网址:http://npm.taobao.org
安装命令:
npm install -g cnpm --registry=https://registry.npm.taobao.org
安装时出现错误
✔️ 解决办法1
可以尝试,先运行:
npm config set registry "http://registry.npmjs.org/"
或者:
npm config set registry https://registry.npm.taobao.org
再执行:
npm install -g cnpm
#配置后可通过下面方式来验证是否成功
npm config get registry
✔️解决办法2
先输入以下命令并运行(记得删除#内容):
#注册模块镜像
npm set registry https://registry.npm.taobao.org
#node-gyp 编译依赖的 node 源码镜像
npm set disturl https://npm.taobao.org/dist
#清空缓存
npm cache clean --force
最后运行:
npm install -g cnpm --registry=https://registry.npm.taobao.org
✔️解决办法3
如果你的错误提示如下:
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
需要先获取权限(Windows用户应该使用右键,选择管理员权限运行cmd即可),先在终端执行命令:
sudo -s
按照提示,输入密码后再执行:
npm install -g cnpm --registry=https://registry.npm.taobao.org
验证安装是否正确
执行命令:
cnpm -v
相关文章推荐
- node.js使用npm 安装插件时提示install Error: ENOENT报错的解决方法
- 简单了解node npm cnpm的具体使用方法
- node.js使用npm 安装插件时提示install Error: ENOENT报错的解决方法
- node.js 第三方模块如何安装(使用npm)及介绍
- 如何在NTLM的代理的后面,使用npm安装node.js的扩展
- windows10安装node.js并修改npm全局目录,使用npm淘宝镜像
- 在win7 64上用npm安装phantomjs时出现Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE错误的解决方法。
- 使用npm安装electron不成功的解决方法
- 使用npm安装electron不成功的解决方法
- window 10 安装node.js时遇到2502 2503错误解决方法
- 不安装node、npm,直接使用uglify批量压缩js文件
- “Ubuntu 环境下npm使用时报错 node: not found 的处理方法”
- 解决安装好node但可能不能使用的问题——用npm检查不显示node的问题
- node.js安装npm模块出现错误
- npm安装composer-rest-server等出现错误node-pre-gyp install --fallback-to-build --library
- 如何利用nvm安装node.js以及node.js概念及使用方法
- nutch1.6安装使用中错误解决方法
- 大数据之Hadoop平台(四)Centos6.5(64bit)Hadoop2.5.1、Zookeeper3.4.6、Hbase0.98.6.1安装使用过程中错误及解决方法