Nodejs 安装与配置
1.下载
2.设置环境变量
配置全局安装的模块路径和缓存路径
- 在nodejs文件夹,创建 node_global
- 在nodejs文件夹,创建 node_cache
npm config set prefix "D:\Program Files\nodejs\node_global"
npm config set cache "D:\Program Files\nodejs\node_cache"
设定成功会在用户下面多一个文件.npmrc。
注:公司收回电脑的管理员权限,我这么配置测试ok。
安装路径以自己的实际路径为准
1.在【用户变量】下【Path】后面新增 D:\Program Files\nodejs\node_global
2.在【系统变量】下【NODE_PATH】,输入D:\Program Files\nodejs\node_modules
3.用脚手架创建项目
1.淘宝镜像
- npm install -g cnpm --registry=https://registry.npm.taobao.org
2.换源
- npm config set registry http://r.cnpmjs.org/
- npm config set registry https://registry.npmjs.org/
- npm config get registry
3.安装脚手架
- npm Install –g create-react-app
4.创建项目
- create-react-app helloworld