react-scripts babel-jest version conflict
See original GitHub issueIs 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:
- Created 4 years ago
- Comments:13 (1 by maintainers)
All jests internal dependencies are specified with a
^
so for a fresh install without a lock file yarn will installjest-cli@24.8.0
forjest@24.7.1
. If you put a resolution onjest-cli@24.7.1
, it will still installjest-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 all2.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.
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 forbabel-jest@24.7.1
and I’ve managed to build with no issues. The only things I’m receiving are warnings when runningyarn install
.Thanks @Pajn