【自用】搭建react项目

Last login: Tue Mar  1 15:31:19 on ttys000
(base) sherrycao@caoxuexuans-MacBook-Pro ~ % sudo npm install -g npx
Password:
npm ERR! code EEXIST
npm ERR! path /usr/local/bin/npx
npm ERR! EEXIST: file already exists
npm ERR! File exists: /usr/local/bin/npx
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/sherrycao/.npm/_logs/2022-03-02T14_26_43_015Z-debug.log

(base) sherrycao@caoxuexuans-MacBook-Pro ~ % cd ./Documents

(base) sherrycao@caoxuexuans-MacBook-Pro Documents % cd ./9900-shop
(base) sherrycao@caoxuexuans-MacBook-Pro 9900-shop % ls
(base) sherrycao@caoxuexuans-MacBook-Pro 9900-shop % sudo 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, and audited 68 packages in 19s

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

3 high severity vulnerabilities

To address all issues, run:
  npm audit fix

Run `npm audit` for details.
(base) sherrycao@caoxuexuans-MacBook-Pro 9900-shop % npx create-react-app frontend

Creating a new React app in /Users/sherrycao/Documents/9900-shop/frontend.

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


added 1369 packages in 8m

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

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 18s

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


removed 1 package, and audited 1407 packages in 5s

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

6 moderate severity vulnerabilities

To address all issues (including breaking changes), run:
  npm audit fix --force

Run `npm audit` for details.

Created git commit.

Success! Created frontend at /Users/sherrycao/Documents/9900-shop/frontend
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 frontend
  npm start

Happy hacking!
(base) sherrycao@caoxuexuans-MacBook-Pro 9900-shop % 
code . 

进入vscode

image.png

通过yarn start让程序跑起来
报错了,或许需要重新装一下yarn
发现用 npm start 也可以,见 https://cloud.tencent.com/developer/article/1850392

你可能感兴趣的:(【自用】搭建react项目)