
上QQ阅读APP看书,第一时间看更新
1.3.1 在Microsoft Windows系统上安装Node.js
1.下载安装包
访问地址https://nodejs.org/en/download/,选择LTS版本,如图1.3所示。选择偶数的Node.js版本,例如8、10,因为Node.js版本迭代较快,偶数是长期稳定版本,有较好的兼容性;而奇数版本是偶数稳定版本前的开发版本。
提示
Node.js也常称作NodeJS。

图1.3 下载Windows对应的安装包
2.安装
(1)双击下载的安装包,如图1.4所示。

图1.4 双击安装包
(2)勾选I accept the terms inthe License Agreement,单击Next(下一步)按钮,如图1.5所示。

图1.5 同意协议
(3)选择安装路径,Node.js默认安装路径为“C:\Program Files\nodejs\”,可以修改为D盘,如图1.6所示。

图1.6 选择安装路径
(4)单击树形图标来选择你需要的安装模式,然后单击Next按钮,如图1.7所示。

图1.7 选择安装模式
(5)单击Install(安装)按钮,开始安装Node.js,如图1.8所示。也可以单击Back(返回)按钮修改之前的配置项。然后单击Next按钮。

图1.8 开始安装Node.js
(6)安装过程如图1.9所示。

图1.9 Node.js安装过程
(7)单击Finish(完成)按钮退出安装向导,如图1.10所示。

图1.10 完成Node.js安装
(8)输入node -v查看Node.js版本号:
$ node -v $ 12.13.1
新版的Node.js已自带NPM,安装Node.js时会同时安装上。通过NPM可以对Node.js依赖的包进行管理,用于安装、卸载、更新使用Node.js时所依赖的包。