npm见问题及解决方案

1.升级提示

AndydeMacBook-Pro:soft andy$ sudo npm install -g cnpm --registry=https://registry.npm.taobao.org
Password:
/usr/local/bin/cnpm -> /usr/local/lib/node_modules/cnpm/bin/cnpm
+ [email protected]
added 325 packages from 182 contributors, removed 445 packages, updated 122 packages and moved 3 packages in 23.846s
   ╭────────────────────────────────────────────────────────────────╮
   │                                                                │
   │       New minor version of npm available! 6.4.1 → 6.11.2       │
   │   Changelog: https://github.com/npm/cli/releases/tag/v6.11.2   │
   │               Run npm install -g npm to update!                │
   │                                                                │
   ╰────────────────────────────────────────────────────────────────╯

解决方案:如上面文字提示

AndydeMacBook-Pro:npm install -g npm

升级出现的问题


升级报错.png

问题原因:如上图提示 问题原因为权限问题
解决方案:

AndydeMacBook-Pro:soft andy$ sudo npm install -g npm
Password:
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
/usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js
+ [email protected]
added 61 packages from 18 contributors, removed 18 packages and updated 69 packages in 7.903s

你可能感兴趣的:(npm见问题及解决方案)