react安装 项目构建

1.nodejs安装node

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

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

2.react环境npm

2.1react脚手架下载服务器

npm install -g create-react-app网络

国内网络较慢可指定仓库app

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

2.2npm仓库设置this

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

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!

相关文章
相关标签/搜索