NODE_npm安装cnpm,npm安装淘宝镜像,nrm查看所有包下载路径

本文介绍了如何通过cnpm来优化npm在中国大陆地区的使用体验,包括安装cnpm、设置默认下载源为淘宝镜像以及安装nrm以查看不同包源的下载速度等内容。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1、安装cnpm,输入以下命令:

npm install -g cnpm --registry=http://registry.npm.taobao.org

// 或者

npm install cnpm -g
// 设置为默认淘宝下载库
npm config set registry https://registry.npm.taobao.org

注意:为了避免每次安装都需要–registry参数,可以使用如下命令
进行永久设置:npm config set registry http://registry.npm.taobao.org

2、查看版本号

cnpm -v

在这里插入图片描述

查看npm安装位置:npm root -g

查看cnpm安装位置:cnpm root -g

清屏命令:cls

3、查看所有包下载路径

安装nrm

npm i nrm -g
// 或
cnpm i nrm -g

查看所有 包下载路径, 也就是存放包的不同位置,自然就有取包的速度区分

nrm ls

在这里插入图片描述

nrm use 使用包路径, 当然也可以直接用 nrm help 查看 nrm 功能帮助

.

C:\Users\admin>npm install -g cnpm --registry=https://registry.npmmirror.com npm WARN notsup Unsupported engine for cnpm@9.4.0: wanted: {"node":">= 14.18.0"} (current: {"node":"13.14.0","npm":"6.14.4"}) npm WARN notsup Not compatible with your version of node/npm: cnpm@9.4.0 npm ERR! code EPERM npm ERR! syscall rename npm ERR! path C:\Program Files\nodejs\node_global\node_modules\cnpm\node_modules\.make-fetch-happen.DELETE\node_modules\@npmcli npm ERR! dest C:\Program Files\nodejs\node_global\node_modules\cnpm\node_modules\make-fetch-happen\node_modules\@npmcli npm ERR! errno -4048 npm ERR! Error: EPERM: operation not permitted, rename 'C:\Program Files\nodejs\node_global\node_modules\cnpm\node_modules\.make-fetch-happen.DELETE\node_modules\@npmcli' -> 'C:\Program Files\nodejs\node_global\node_modules\cnpm\node_modules\make-fetch-happen\node_modules\@npmcli' npm ERR! [OperationalError: EPERM: operation not permitted, rename 'C:\Program Files\nodejs\node_global\node_modules\cnpm\node_modules\.make-fetch-happen.DELETE\node_modules\@npmcli' -> 'C:\Program Files\nodejs\node_global\node_modules\cnpm\node_modules\make-fetch-happen\node_modules\@npmcli'] { npm ERR! cause: [Error: EPERM: operation not permitted, rename 'C:\Program Files\nodejs\node_global\node_modules\cnpm\node_modules\.make-fetch-happen.DELETE\node_modules\@npmcli' -> 'C:\Program Files\nodejs\node_global\node_modules\cnpm\node_modules\make-fetch-happen\node_modules\@npmcli'] { npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall: 'rename', npm ERR! path: 'C:\\Program Files\\nodejs\\node_global\\node_modules\\cnpm\\node_modules\\.make-fetch-happen.DELETE\\node_modules\\@npmcli', npm ERR! dest: 'C:\\Program Files\\nodejs\\node_global\\node_modules\\cnpm\\node_modules\\make-fetch-happen\\node_modules\\@npmcli' npm ERR! }, npm ERR! errno: -4048, npm ERR! code: 'EPERM', npm ERR! syscall: 'rename', npm ERR! path: 'C:\\Program Files\\nodejs\\node_global\\node_modules\\cnpm\\node_modules\\.make-fetch-happen.DELETE\\node_modules\\@npmcli', npm ERR! dest: 'C:\\Program Files\\nodejs\\node_global\\node_modules\\cnpm\\node_modules\\make-fetch-happen\\node_modules\\@npmcli', npm ERR! parent: 'cnpm' npm ERR! } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It's possible that the file was already in use (by a text editor or antivirus), npm ERR! or that you lack permissions to access it. 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. npm ERR! A complete log of this run can be found in: npm ERR! C:\Program Files\nodejs\node_cache\_logs\2025-03-26T06_50_26_294Z-debug.log
03-27
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值