react安装 项目构建

1.nodejs安装

下载安装包,解压。如果是已编译文件,在/etc/profile中设置PATH(/etc/profile文件中的变量设置,所有用户可用,但需求重启服务器),并source /etc/profile。如果不是则进行编译安装。

node -v 显示版本号则安装成功。

2.react环境

2.1react脚手架下载

npm install -g create-react-app

国内网络较慢可指定仓库

npm install -g create-react-app --registry https://registry.npm.taobao.org

2.2npm仓库设置

npm config set registry https://registry.npm.taobao.org

3.react项目架建

create-react-app web

cd web

npm run start

4.react相关指令

4.1 npm start或npm run start

Starts the developent server.

4.2 npm run build

Bundles the app into static file for production.

4.3 npm test

Starts the test runner.

4.4 npm run eject

Removes this tool and copies build dependencies, config files and scripts into the app directory. If you do this, you can't go back!

 

posted @ 2017-12-15 09:40  Brin Page  阅读(141)  评论(0编辑  收藏  举报