React脚手架搭建过程

1:创建一个空文件夹

2:cmd空文件夹

3:因为npm默认从国外下载,为了下载速度,切换到国内的淘宝镜像

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

4:查看是否切换成功

npm config get registry

5:安装react脚手架

npm i -g create-react-app

6:创建react

create-react-app progect(progect是项目名字文件夹)


Microsoft Windows [版本 10.0.17763.864]
(c) 2018 Microsoft Corporation。保留所有权利。

C:\Users\浪子\Desktop\react>
C:\Users\浪子\Desktop\react>npm config get registry
https://registry.npm.taobao.org/

C:\Users\浪子\Desktop\react>npm i -g create-react-app
C:\Users\浪子\AppData\Roaming\npm\create-react-app -> C:\Users\浪子\AppData\Roaming\npm\node_modules\create-react-app\index.js
+ create-react-app@3.2.0
updated 1 package in 6.111s

C:\Users\浪子\Desktop\react>create-react-app react_project

Creating a new React app in C:\Users\浪子\Desktop\react\react_project.

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


> core-js@2.6.10 postinstall C:\Users\浪子\Desktop\react\react_project\node_modules\babel-runtime\node_modules\core-js
> node postinstall || echo "ignore"


> core-js@3.2.1 postinstall C:\Users\浪子\Desktop\react\react_project\node_modules\core-js
> node scripts/postinstall || echo "ignore"

+ react-scripts@3.2.0
+ react@16.12.0
+ react-dom@16.12.0
added 1480 packages from 694 contributors in 184.767s

Success! Created react_project at C:\Users\浪子\Desktop\react\react_project
Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd react_project
  npm start

Happy hacking!

7:创建成功后,就可在对应的文件夹内看到所安装的文价包

8:进入对应的文件 启动react-app

指令:npm start
C:\Users\浪子\Desktop\react>cd react_project

C:\Users\浪子\Desktop\react\react_project>npm start

> react_project@0.1.0 start C:\Users\浪子\Desktop\react\react_project
> react-scripts start
Starting the development server...
Compiled successfully!

You can now view react_project in the browser.

  Local:            http://localhost:3000/
  On Your Network:  http://10.110.72.206:3000/

Note that the development build is not optimized.
To create a production build, use npm run build.

 

如图所示 即为创建成功 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值