详细报错
D:workspacees61> 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:UsersAdministratorAppDataRoaming pm ode_modules.staging pm-bb88aed9 ode_modules ead-installed est' npm ERR! path C:UsersAdministratorAppDataRoaming pm ode_modules.staging pm-bb88aed9 ode_modulesabbrev npm ERR! code ENOENT npm ERR! errno -4058 npm ERR! syscall rename npm ERR! enoent ENOENT: no such file or directory, rename 'C:UsersAdministratorAppDataRoaming pm ode_modules.staging pm-bb88aed9 ode_modulesabbrev' -> 'C:UsersAdministratorAppDataRoaming pm ode_modules.stagingabbrev-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:UsersAdministratorAppDataRoaming pm-cache\_logs2019-02-24T14_16_24_548Z-debug.log PS D:workspacees61> 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:UsersAdministratorAppDataRoaming pm-cache\_logs2019-02-24T14_18_17_575Z-debug.log PS D:workspacees61> 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:UsersAdministratorAppDataRoaming pm-cache\_logs2019-02-24T14_21_13_999Z-debug.log PS D:workspacees61> 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:UsersAdministratorAppDataRoaming pm-cache\_logs2019-02-24T14_21_24_209Z-debug.log
解决
是因为cnpm 的安装版本需要 npm版本支持
1 cnpm -v 找到cnpm版本号
cnpm -v cnpm@6.0.0 (C:UsersAdministratorAppDataRoaming pm ode_modulescnpmlibparse_argv.js) npm@6.8.0 (C:UsersAdministratorAppDataRoaming pm ode_modulescnpm ode_modules pmlib pm.js) node@8.9.3 (D:Program Files ool odejs ode.exe) npminstall@3.20.2 (C:UsersAdministratorAppDataRoaming pm ode_modulescnpm ode_modules pminstalllibindex.js) prefix=C:UsersAdministratorAppDataRoaming pm 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 成功