Saturday, April 13, 2024
 Popular · Latest · Hot · Upcoming
24
rated 0 times [  28] [ 4]  / answers: 1 / hits: 11285  / 3 Years ago, tue, january 26, 2021, 12:00:00

Every time I try running npm start on a new project I keep on getting this error. Does anyone know or have any idea how to fix this??



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


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


"babel-jest": "^26.6.0"


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


D:node_modulesbabel-jest (version: 24.9.0)


Manually installing incompatible versions is known to cause
hard-to-debug issues.


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


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



  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 has
not 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_modulesbabel-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 file
in your project. That would permanently disable this preflight check
in 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!
[email protected] start: react-scripts start npm ERR! Exit
status 1 npm ERR! npm ERR! Failed at the [email protected] start
script. npm ERR! This is probably not a problem with npm. There is
likely additional logging output above.


npm ERR! A complete log of this run can be found in: npm ERR!

C:UserssmasoAppDataRoamingnpm-cache_logs2021-01-26T22_50_48_484Z-debug.log



More From » reactjs

 Answers
22

I also face this problem. Simple solution of this problem is:
1)create .env file.
2) add SKIP_PREFLIGHT_CHECK=true in the file.
3) npm start


[#1886] Friday, January 22, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
marcos

Total Points: 331
Total Questions: 106
Total Answers: 104

Location: Gabon
Member since Sat, Jul 25, 2020
4 Years ago
marcos questions
Thu, Feb 24, 22, 00:00, 2 Years ago
Sat, Apr 17, 21, 00:00, 3 Years ago
Mon, Feb 1, 21, 00:00, 3 Years ago
Wed, Jan 6, 21, 00:00, 3 Years ago
Tue, May 26, 20, 00:00, 4 Years ago
;