建立React腳手架

node版本10.14.2 下載地址css

若是是其版本的話會出錯 css-loader 會不兼容 主要是8.x的版本不兼容node

npm install -g create-react-app 全局安裝 create-react-appreact

create-react-app react_app 使用create-react-app安裝一個react腳手架 文件夾爲 react_appnpm

D:\>create-react-app react_app

Creating a new React app in D:\react_app.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

yarn add v1.12.3
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.4: The platform "win32" is incompatible with this module.
info "fsevents@1.2.4" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Saved lockfile.
success Saved 6 new dependencies.
info Direct dependencies
├─ react-dom@16.6.3
├─ react-scripts@2.1.1
└─ react@16.6.3
info All dependencies
├─ babel-preset-react-app@6.1.0
├─ react-dev-utils@6.1.1
├─ react-dom@16.6.3
├─ react-error-overlay@5.1.0
├─ react-scripts@2.1.1
└─ react@16.6.3
Done in 81.77s.

Success! Created react_app at D:\react_app
Inside that directory, you can run several commands:

表示安裝成功babel

yarn start 或者 npm run start 啓動項目app

相關文章
相關標籤/搜索