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!

相關文章
相關標籤/搜索