mac更新node,npm版本

2021/11/16 9:09:53

本文主要是介绍mac更新node,npm版本,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

#1.查看node版本

MacBook-Pro:~ syd$ node -v

v14.15.0

#2.清除缓存

sydMacBook-Pro:~ syd$ sudo npm cache clean -f

Password:

npm WARN using --force I sure hope you know what you are doing.

# 3.安装n工具,用来管理node.js版本的

sydMacBook-Pro:~ syd$ sudo npm install -g n

/usr/local/bin/n -> /usr/local/lib/node_modules/n/bin/n

+ n@8.0.0

updated 1 package in 4.816s

#4.安装最新版本的node.js

syddeMacBook-Pro:~ sydg$ sudo n stable

  installing : node-v16.13.0

       mkdir : /usr/local/n/versions/node/16.13.0

       fetch : https://nodejs.org/dist/v16.13.0/node-v16.13.0-darwin-x64.tar.xz

   installed : v16.13.0 (with npm 8.1.0)

#5.安装最新的npm

sydMacBook-Pro:~ syd$ sudo npm install npm@latest -g

Password:

removed 2 packages, changed 15 packages, and audited 219 packages in 11s

 

10 packages are looking for funding

  run `npm fund` for details

 

3 moderate severity vulnerabilities

 

To address all issues, run:

  npm audit fix

 

Run `npm audit` for details.

npm notice 

npm notice New patch version of npm available! 8.1.0 -> 8.1.3

npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.1.3

npm notice Run npm install -g npm@8.1.3 to update!

npm notice 

syddeMacBook-Pro:~ syd$ node -v

v16.13.0

sydMacBook-Pro:~ syd$ npm -v



这篇关于mac更新node,npm版本的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程