全局安装react

1、首先安装react脚手架

npm install -g create-react-app

2、创建react项目

create-react-app my-app

3、

PS D:\桌面\papers\subject> create-react-app my-react-app

Creating a new React app in D:\桌面\papers\subject\my-react-app.

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


added 1479 packages in 27s

252 packages are looking for funding
  run `npm fund` for details

Initialized a git repository.

Installing template dependencies using npm...
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@testing-library/dom@10.4.0',
npm WARN EBADENGINE   required: { node: '>=18' },
npm WARN EBADENGINE   current: { node: 'v16.17.0', npm: '8.15.0' }
npm WARN EBADENGINE }

added 63 packages, and changed 1 package in 6s

252 packages are looking for funding
  run `npm fund` for details
Removing template package using npm...

npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE   package: '@testing-library/dom@10.4.0',
npm WARN EBADENGINE   required: { node: '>=18' },
npm WARN EBADENGINE   current: { node: 'v16.17.0', npm: '8.15.0' }
npm WARN EBADENGINE }

removed 1 package in 1s

252 packages are looking for funding
  run `npm fund` for details

Created git commit.

Success! Created my-react-app at D:\桌面\papers\subject\my-react-app
Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
  npm test
    Starts the test runner.

  npm run eject
Compiled successfully!```

3、根据提示进入项目目录

```javascript
cd my-react-app

4、启动项目

npm run start

5、浏览器中出现react图标项目就创建成功并运行了
在这里插入图片描述

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值