'cnpm' is not recognized as an internal or external command

'cnpm' is not recognized as an internal or external command

切换administrator账号cnpm不识别

解决:

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

卸载nodejs,重新安装

注:@nuxt.js/cli找不到,删除node_modules重新cnpm i

错误提示

npm install -g cnpm --registry=https://registry.npm.taobao.org
npm ERR! code SELF_SIGNED_CERT_IN_CHAIN
npm ERR! errno SELF_SIGNED_CERT_IN_CHAIN
npm ERR! request to https://registry.npm.taobao.org/cnpm failed, reason: self signed certificate in certificate chain

npm ERR! A complete log of this run can be found in:
npm ERR! C:UserscluAppDataRoaming pm-cache\_logs2020-12-23T05_28_08_155Z-debug.log

安装成功

npm install -g cnpm --registry=https://registry.npm.taobao.org
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
C:UserscluAppDataRoaming pmcnpm -> C:UserscluAppDataRoaming pm ode_modulescnpmincnpm
+ cnpm@6.1.1
added 689 packages from 972 contributors in 1368.413s

'npm' is not recognized as internal or external command, operable program or batch file

Just add:

;C:Program Files
odejs

To the end of your Path variable on the "User variable" section of the Environment Variables on the System Properties.

After that, reopen your command prompt and type

npm

This should work.

使用这个的前提是,先去官方下载安装包。

https://nodejs.org/en/download/

node-v14.17.5-x64.msi 安装之后,对应的路径下,就会有了

>npm  version
{
  npm: '6.14.14',
  ares: '1.17.2',
  brotli: '1.0.9',
  cldr: '39.0',
  icu: '69.1',
  llhttp: '2.1.3',
  modules: '83',
  napi: '8',
  nghttp2: '1.42.0',
  node: '14.17.5',
  openssl: '1.1.1k',
  tz: '2021a',
  unicode: '13.0',
  uv: '1.41.0',
  v8: '8.4.371.23-node.76',
  zlib: '1.2.11'
}

原文地址:https://www.cnblogs.com/chucklu/p/14178126.html