node.js安装篇
2017-07-26 本文已影响0人
Camille宝妹
node.js中文官方文档地址:http://nodejs.cn
下载地址:https://nodejs.org/en/download
新版的node.js自带npm,npm就是node.js的包管理
如下图所示:

-
下载完之后会有一个.msi的文件,双击打开
Image.png
-
双击打开,next下一步,最后finish完成安装
-
检查是否安装成功:
1.win+R打开,输入cmd打开小黑窗
2.输入node -v检查node安装的版本号
3.输入npm -v检查npm安装的版本号

- 环境配置:
配置npm安装的全局模块所在的路径以及缓存的cache路径
在安装node的文件夹下创建两个新的文件夹

- 打开小黑窗,输入
npm config set prefix"node安装的路径\node_global"
npm config set cache "node安装的路径 \node_cache"

- 配置环境变量:
右键“我的电脑”->属性->系统->高级系统设置->系统属性->高级->环境变量

-
修改用户变量PATH的值
image.png
-
新建系统变量
image.png
-
安装全局的express模块
npm install express -g --http://npm.taobao.org/mirrors/node
注:-g代表全局安装
http://npm.taobao.org/mirrors/node](http://npm.taobao.org/mirrors/node 是淘宝镜像的地址,速度比直接安装快很多

能安装express说明安装完成