NPM & NODE 升级最新版

honvid -
NPM & NODE 升级最新版
版本查看
$ npm -v
npm WARN npm npm does not support Node.js v14.8.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm You can find the latest version at https://nodejs.org/
8.0.0

$ node -v
v14.8.0
NPM 更新
$ npm install -g npm
/usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
npm WARN notsup Unsupported engine for npm@8.0.0: wanted: {"node":"^12.13.0 || ^14.15.0 || >=16"} (current: {"node":"14.8.0","npm":"6.14.7"})
npm WARN notsup Not compatible with your version of node/npm: npm@8.0.0
NODE 更新
# 清理缓存
$ npm cache clean -f
npm WARN npm npm does not support Node.js v14.8.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm You can find the latest version at https://nodejs.org/
npm WARN using --force Recommended protections disabled.

# 安装n模块
$ npm install -g n
npm WARN npm npm does not support Node.js v14.8.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm You can find the latest version at https://nodejs.org/

added 1 package, and audited 2 packages in 6s

found 0 vulnerabilities

# 注意要加 sudo,否则会报权限问题
$ sudo n stable
Password:
  installing : node-v14.18.0
       mkdir : /usr/local/n/versions/node/14.18.0
       fetch : https://nodejs.org/dist/v14.18.0/node-v14.18.0-darwin-x64.tar.xz
Done
特别申明:本文内容来源网络,版权归原作者所有,如有侵权请立即与我们联系(cy198701067573@163.com),我们将及时处理。

Tags 标签

node.jsnpm前端

扩展阅读

加个好友,技术交流

1628738909466805.jpg