创建React脚手架

node版本10.14.2 下载地址

如果是其版本的话会出错 css-loader 会不兼容 主要是8.x的版本不兼容

npm install -g create-react-app 全局安装 create-react-app

create-react-app react_app 使用create-react-app安装一个react脚手架 文件夹为 react_app

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:

表示安装成功

yarn start 或者 npm run start 启动项目

posted on 2018-12-19 17:01  Lightt  阅读(362)  评论(0编辑  收藏  举报