如何更新当前系统的npm和node版本 (on windows)

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/stanxl/article/details/78711421

今天第一天入职新公司,公司给配的电脑,win7系统,大致看了一下,不是全新,已经被轮过了,检查了下node的版本,发现不是当前最力荐的,npm也不是最新的。所以当即决定更新到最适合的版本。

我比较喜欢用vscode作为编辑器,所以先安装了vscode,以下进行的更新都是在vscode中进行的。

先更新npm:

npm cache clean --force

再执行:

npm update -g

执行完成后,就可以看到当前最新的npm版本了。

C:\Users\Administrator>npm -v
5.6.0

接下来去更新node.js的版本,查了点资料,最后参考的这里:点击看详情,它里面是这么介绍的:

How to Update Node (Windows/macOS) Using Installers on Nodejs.org
========================================================================
The Node.js downloads page includes binary packages for Windows and macOS
 — but why make your life more difficult? The pre-made installers — .msi for Windows
and .pkg for macOS — make the installation process unbelievably efficient 
and understandable. Download and run the file, and let the installation wizard 
take care of the rest. With each downloaded update, the newer versions of Node 
and npm will replace the older version.

Alternatively, macOS users can use the npm and n instructions above.

二话不多说,直接去node.js的download页面:寻找.msi文件,点击下载后,直接运行就可以了,运行结束后,再去看下node的版本:

C:\Users\Administrator>node -v
v8.9.1

至此更新完毕,对于node.js版本的更新并没有使用命令行的模式,也查阅了一些,好像也需要安装一些东西,所以暂且先不用命令行去更新node.js了。

猜你喜欢

转载自blog.csdn.net/stanxl/article/details/78711421