[英]React.js - warnings & errors while using "npx create-react-app" command
I get some warnings and errors messages when try to create a react.js app using the command npx creat-react-app
尝试使用命令 npx
npx creat-react-app
创建 react.js 应用程序时,我收到一些警告和错误消息
here is the terminal output containing the errors I get.这是包含我得到的错误的终端输出。 also I wanna specify that when the react.js app is created regardless of these errors it's actually working.
我还想指定当 react.js 应用程序创建时,无论这些错误如何,它实际上都在工作。 but I'm afraid of that if there is something missing.
但我害怕如果缺少什么。 Node.js and all of the required tools are installed as well.
Node.js 和所有必需的工具也已安装。
Node.js version: LTS Version 12.18.4 (includes npm 6.14.6) Node.js 版本:LTS 版本 12.18.4(包括 npm 6.14.6)
C:\Users\Administrator\Desktop\cmder
λ npx create-react-app my-app
Creating a new React app in C:\Users\Administrator\Desktop\cmder\my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
> core-js@2.6.11 postinstall C:\Users\Administrator\Desktop\cmder\my-app\node_modules\babel-runtime\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"
> core-js@3.6.5 postinstall C:\Users\Administrator\Desktop\cmder\my-app\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"
> core-js-pure@3.6.5 postinstall C:\Users\Administrator\Desktop\cmder\my-app\node_modules\core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"
+ react-dom@16.13.1
+ react-scripts@3.4.3
+ cra-template@1.0.3
+ react@16.13.1
added 1598 packages from 746 contributors and audited 1602 packages in 65.645s
69 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Initialized a git repository.
Installing template dependencies using npm...
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ @testing-library/user-event@7.2.1
+ @testing-library/jest-dom@4.2.4
+ @testing-library/react@9.5.0
added 36 packages from 57 contributors and audited 1638 packages in 13.978s
69 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Removing template package using npm...
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\watchpack-chokidar2\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules\webpack-dev-server\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
removed 1 package and audited 1637 packages in 10.641s
69 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Git commit not created Error: Command failed: git commit -m "Initialize project using Create React App"
at checkExecSyncError (child_process.js:630:11)
at execSync (child_process.js:666:15)
at tryGitCommit (C:\Users\Administrator\Desktop\cmder\my-app\node_modules\react-scripts\scripts\init.js:62:5)
at module.exports (C:\Users\Administrator\Desktop\cmder\my-app\node_modules\react-scripts\scripts\init.js:334:25)
at [eval]:3:14
at Script.runInThisContext (vm.js:120:18)
at Object.runInThisContext (vm.js:309:38)
at Object.<anonymous> ([eval]-wrapper:10:26)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at evalScript (internal/process/execution.js:94:25) {
status: 128,
signal: null,
output: [ null, null, null ],
pid: 1532,
stdout: null,
stderr: null
}
Removing .git directory...
Success! Created my-app at C:\Users\Administrator\Desktop\cmder\my-app
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 my-app
npm start
Happy hacking!
Git commit not created Error: Command failed: git commit -m "Initialize project using Create React App"
Git提交未创建错误:命令失败:git commit -m“使用创建反应应用程序初始化项目”
Seems like you don't have git installed.好像你没有安装git。 Install git if you want cra to initialize a git repository.
如果您希望 cra 初始化 git 存储库,请安装 git。 If you don't plan on using git, you should just ignore the error.
如果您不打算使用 git,则应该忽略该错误。
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN notsup 跳过可选依赖项:fsevents@2.1.2 不受支持的平台:想要 {"os":"darwin","arch":"any"}(当前:{"os":"win32","arch": "x64"})
This is an optional dependency for mac (darwin)这是 mac (darwin) 的可选依赖项
This thread points out that you can use npm install --no-optional
to prevent warning from happening. 该线程指出您可以使用
npm install --no-optional
来防止发生警告。
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 ||
npm WARN tsutils@3.17.1 需要一个 typescript@>=2.8.0 || >= 3.2.0-dev ||
>= 3.2.0-dev || >= 3.3.0-dev ||
>= 3.3.0-dev || >= 3.4.0-dev ||
>= 3.4.0-dev || >= 3.5.0-dev ||
>= 3.5.0-dev || >= 3.6.0-dev ||
>= 3.6.0-dev || >= 3.6.0-beta ||
>= 3.6.0-beta || >= 3.7.0-dev ||
>= 3.7.0-dev || >= 3.7.0-beta but none is installed.
>= 3.7.0-beta 但没有安装。 You must install peer dependencies yourself.
您必须自己安装对等依赖项。
Seems like cra use typescript and ask you to install a version a typescript above 2.8.0.似乎 cra 使用打字稿并要求您安装 2.8.0 以上的打字稿版本。
npm i -g typescript
should solve the problem应该解决问题
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.