使用 React 脚手架初始化项目

使用 React 脚手架初始化项目

1.初始化项目,命令: npx create-react-app my-app

image


PS D:\nodeproject> npx create-react-app my-app
Need to install the following packages:
create-react-app@5.0.1
Ok to proceed? (y) y
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, 
which is much more comprehensive and powerful.
npm warn deprecated fstream-ignore@1.0.5: This package is no longer supported.
npm warn deprecated rimraf@2.7.1: Rimraf versions prior to v4 are no longer supported
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported
npm warn deprecated uid-number@0.0.6: This package is no longer supported.
npm warn deprecated fstream@1.0.12: This package is no longer supported.
npm warn deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
Creating a new React app in D:\nodeproject\my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
added 1483 packages in 2m
261 packages are looking for funding
  run `npm fund` for details
Initialized a git repository.
Installing template dependencies using npm...
added 63 packages, and changed 1 package in 17s
261 packages are looking for funding
  run `npm fund` for details
Removing template package using npm...
removed 1 package in 6s
261 packages are looking for funding
  run `npm fund` for details
Git commit not created Error: Command failed: git commit -m "Initialize project using Create React App"
    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at checkExecSyncError (node:child_process:890:11)
    at execSync (node:child_process:962:15)
    at tryGitCommit (D:\nodeproject\my-app\node_modules\react-scripts\scripts\init.js:62:5)       
    at module.exports (D:\nodeproject\my-app\node_modules\react-scripts\scripts\init.js:350:25)   
    at [eval]:3:14
    at runScriptInThisContext (node:internal/vm:209:10)
    at node:internal/process/execution:118:14
    at [eval]-wrapper:6:24 {
  status: 128,
  signal: null,
  output: [ null, null, null ],
  pid: 23720,
  stdout: null,
  stderr: null
}
Removing .git directory...
Success! Created my-app at D:\nodeproject\my-app
Inside that directory, you can run several commands:
    Starts the development server.
  npm run build
    Bundles the app into static files for production.
  npm test
    Starts the test runner.
  npm run eject
Compiled successfully!
You can now view my-app in the browser.
  Local:            http://localhost:3000
  On Your Network:  http://192.168.75.1:3000
Note that the development build is not optimized.
To create a production build, use npm run build.
webpack compiled successfully




2.启动项目,在项目根目录执行命令:npm start

标签:

  • 声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
  • 本文地址:https://www.609ai.com/node/459.html
node 命令行可以执行,vs code执行不了的时候:PowerShell权限问题
没有了