question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

react-scripts babel-jest version conflict

See original GitHub issue

Is this a bug report?

Yes

Environment

Node: 10.15.3 NPM: 6.9.0 Yarn: 1.16.0

Output of npx create-react-app --info

Environment Info:

System: OS: Linux 5.0 Solus 4.0 CPU: (4) x64 Intel® Core™ i5-5200U CPU @ 2.20GHz Binaries: Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node Yarn: 1.16.0 - /usr/bin/yarn npm: 6.9.0 - ~/.nvm/versions/node/v10.15.3/bin/npm Browsers: Chrome: Not Found Firefox: 66.0.5 npmPackages: react: ^16.8.6 => 16.8.6 react-dom: ^16.8.6 => 16.8.6 react-scripts: 3.0.0 => 3.0.0 npmGlobalPackages: create-react-app: Not Found

Steps to Reproduce

Use the react-scripts dependency version 3.0.0

Expected Behavior

I would expect there to be no version conflicts in official packages which are part of the same official project and that running yarn run start would exit cleanly.

Actual Behavior

Running yarn run start which runs react-scripts start outputs the following error:

$ react-scripts start

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": "24.7.1"

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:

  /home/<a-user>/central/src/github.com/<a-user>/portfolio/node_modules/babel-jest (version: 24.8.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:

  5. 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.

  6. Check if /home/<a-user>/central/src/github.com/<a-user>/portfolio/node_modules/babel-jest is outside your project directory.
     For example, you might have accidentally installed something in your home folder.

  7. 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!

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:13 (1 by maintainers)

github_iconTop GitHub Comments

3reactions
Pajncommented, Jun 7, 2019

All jests internal dependencies are specified with a ^ so for a fresh install without a lock file yarn will install jest-cli@24.8.0 for jest@24.7.1. If you put a resolution on jest-cli@24.7.1, it will still install jest-config@24.8.0.

You can put a resolution for babel-jest@24.7.1 which do work but generates warnings when running yarn as all 2.8.0 packages has the range ^2.8.0.

This issue should be solved when #7007 is released. But as of now, create-react-app tries to verify something that neither yarn nor jest is guaranteeing.

1reaction
robertcoopercodecommented, Jun 7, 2019

I somehow managed to get it passing locally, but my CI server was failing with the same issue regarding babel-jest versions. I’ve taken @Pajn’s advice and used a resolution for babel-jest@24.7.1 and I’ve managed to build with no issues. The only things I’m receiving are warnings when running yarn install.

Thanks @Pajn

Read more comments on GitHub >

github_iconTop Results From Across the Web

Issue with babel-jest dependency when running npm start in a ...
My react-scripts version is 4.0.3 . The problem suddenly happened after installing a private remote package ...
Read more >
How to resolve create-react-app babel-jest Error. - Medium
1)Manually installing incompatible versions is known to cause hard-to-debug issues.If you would prefer to ignore this check, add ...
Read more >
babel-jest version conflict in react + node application-babel.js
It is likely not a bug in Create React App, but something you need to fix locally. The react-scripts package provided by Create...
Read more >
Babel-Jest Version Conflict In React + Node Application
"The react-scripts package provided by Create React App requires a dependency: I had to install the correct babel loader and then webpack. I...
Read more >
the react-scripts package provided by create react app ...
However, a different version of babel-eslint was detected higher up in the tree: ... other package (apart from the expected react-scripts) installed jest....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found