gpt4 book ai didi

javascript - 需要关于我不断收到的 react.js 错误的帮助

转载 作者:行者123 更新时间:2023-12-04 16:25:17 32 4
gpt4 key购买 nike

每次我尝试在新项目上运行 npm start 时,我都会不断收到此错误。有谁知道或知道如何解决这个问题?

There might be a problem with the project dependency tree. It islikely not a bug in Create React App, but something you need to fixlocally.

The react-scripts package provided by Create React App requires adependency:

"babel-jest": "^26.6.0"

Don't try to install it manually: your package manager does itautomatically. However, a different version of babel-jest was detectedhigher up in the tree:

D:\node_modules\babel-jest (version: 24.9.0)

Manually installing incompatible versions is known to causehard-to-debug issues.

If you would prefer to ignore this check, addSKIP_PREFLIGHT_CHECK=true to an .env file in your project. That willpermanently disable this message but you might encounter other issues.

To fix the dependency tree, try following the steps below in the exactorder:

  1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
  2. Delete node_modules in your project folder.
  3. Remove "babel-jest" from dependencies and/or devDependencies in the package.json file in your project folder.
  4. Run npm install or yarn, depending on the package manager you use.

In most cases, this should be enough to fix the problem. If this hasnot helped, there are a few other things you can try:

  1. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.This may help because npm has known issues with package hoisting which may get resolved in future versions.

  2. Check if D:\node_modules\babel-jest is outside your project directory.For example, you might have accidentally installed something in your home folder.

  3. Try running npm ls babel-jest in your project folder.This will tell you which other package (apart from the expected react-scripts) installed babel-jest.

If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env filein your project. That would permanently disable this preflight checkin case you want to proceed anyway.

P.S. We know this message is long but please read the steps above :-)We hope you find them helpful!

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR!react-portfolio@0.1.0 start: react-scripts start npm ERR! Exitstatus 1 npm ERR! npm ERR! Failed at the react-portfolio@0.1.0 startscript. npm ERR! This is probably not a problem with npm. There islikely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\smaso\AppData\Roaming\npm-cache_logs\2021-01-26T22_50_48_484Z-debug.log

最佳答案

我也面临这个问题。这个问题的简单解决方案是:
1) 创建 .env 文件。
2) 添加 SKIP_PREFLIGHT_CHECK=真在文件中。
3) 启动

关于javascript - 需要关于我不断收到的 react.js 错误的帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65910495/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com