1. 程式人生 > 其它 >React開發環境的搭建

React開發環境的搭建

React

  • React開發環境的搭建
點選檢視程式碼
C:\Users\Thinkpad>node -v
v16.13.0

C:\Users\Thinkpad>npm -v
8.1.0

C:\Users\Thinkpad>npm install -g create-react-app
npm WARN deprecated [email protected]: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.

added 67 packages in 13s

C:\Users\Thinkpad>e:

E:\>mkdir ReactDemo

E:\>cd ReactDemo

E:\ReactDemo>create-react-app demo01

Creating a new React app in E:\ReactDemo\demo01.

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


added 1368 packages in 3m

Initialized a git repository.

Installing template dependencies using npm...
npm WARN deprecated [email protected]: See https://github.com/lydell/source-map-resolve#deprecated

added 38 packages in 13s
Removing template package using npm...


removed 1 package in 4s

Created git commit.

Success! Created demo01 at E:\ReactDemo\demo01
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 demo01
  npm start

Happy hacking!

E:\ReactDemo>dir
 驅動器 E 中的卷是 新加捲
 卷的序列號是 08E3-5EFB

 E:\ReactDemo 的目錄

2022/03/02  19:49    <DIR>          .
2022/03/02  19:49    <DIR>          ..
2022/03/02  19:52    <DIR>          demo01
               0 個檔案              0 位元組
               3 個目錄 29,741,875,200 可用位元組

E:\ReactDemo>cd demo01

E:\ReactDemo\demo01>dir
 驅動器 E 中的卷是 新加捲
 卷的序列號是 08E3-5EFB

 E:\ReactDemo\demo01 的目錄

2022/03/02  19:52    <DIR>          .
2022/03/02  19:52    <DIR>          ..
2022/03/02  19:50               310 .gitignore
2022/03/02  19:53    <DIR>          node_modules
2022/03/02  19:53         1,121,815 package-lock.json
2022/03/02  19:53               809 package.json
2022/03/02  19:52    <DIR>          public
2022/03/02  19:51             3,359 README.md
2022/03/02  19:52    <DIR>          src
               4 個檔案      1,126,293 位元組
               5 個目錄 29,741,875,200 可用位元組

E:\ReactDemo\demo01>npm start