共计 1356 个字符,预计需要花费 4 分钟才能阅读完成。
版本查看
$ 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
正文完