npm 安装cnpm淘宝镜像时报错解决

详细报错

D:\workspace\es61> npm install -g cnpm --registry=https://registry.npm.taobao.org
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.0
npm WARN tar ENOENT: no such file or directory, lstat 'C:\Users\Administrator\AppData\Roaming\npm\node_modules\.staging\npm-bb88aed9\node_modules\read-installed\test'
npm ERR! path C:\Users\Administrator\AppData\Roaming\npm\node_modules\.staging\npm-bb88aed9\node_modules\abbrev
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\Administrator\AppData\Roaming\npm\node_modules\.staging\npm-bb88aed9\node_modules\abbrev' -> 'C:\Users\Administrator\AppData\Roaming\npm\node_modules\.staging\abbrev-99695b0f'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-02-24T14_16_24_548Z-debug.log
PS D:\workspace\es61> npm install -g cnpm --registry=https://registry.npm.taobao.org^C^C^C^C^C^C^C^C^C^C
npm ERR! Request path contains unescaped characters

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-02-24T14_18_17_575Z-debug.log
PS D:\workspace\es61> npm install -g cnpm@5.51 --registry=https://registry.npm.taobao.org
npm ERR! code ETARGET
npm ERR! notarget No matching version found for cnpm@5.51
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-02-24T14_21_13_999Z-debug.log
PS D:\workspace\es61> npm install -g cnpm@5.5.1 --registry=https://registry.npm.taobao.org
npm ERR! code ETARGET
npm ERR! notarget No matching version found for cnpm@5.5.1
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2019-02-24T14_21_24_209Z-debug.log

  解决

是因为cnpm 的安装版本需要 npm版本支持   

1 cnpm -v 找到cnpm版本号

 

cnpm -v
cnpm@6.0.0 (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\lib\parse_argv.js)
npm@6.8.0 (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\npm\lib\npm.js)
node@8.9.3 (D:\Program Files\tool\nodejs\node.exe)
npminstall@3.20.2 (C:\Users\Administrator\AppData\Roaming\npm\node_modules\cnpm\node_modules\npminstall\lib\index.js)
prefix=C:\Users\Administrator\AppData\Roaming\npm
win32 x64 10.0.14393
registry=https://registry.npm.taobao.org

 

2 使用命令安装npm

npm install npm@6.0.0

3 再次执行安装命令

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

4 成功

 

上一篇:解决AppData/Local/Microsoft/WindowsApps/python: Permission denied


下一篇:如何清除SQLServer服务器名称、登录名等