You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Pinning all of our dependencies causes issues with the preflight check whenever a new version of a nested dependency is released. babel-jest is one example of this. When a new version is released and used by another dependency the preflight check fails until we update our version to match.
We should consider unpinning certain dependencies like babel-jest and updating the preflight check to work with carrot versions like ^24.7.1. It currently only works with exact version numbers.
Here's an example we get a preflight warning in our CI. We noticed this quite a bit the last few days as Jest has released a few new versions in quick succession. Each new release would break CI.
This is an example npm ls babel-jest output when everything works nicely:
However when a new version of jest comes out, let's say 24.6.0, even though we pinned jest@24.5.0 and babel-jest@24.5.0, jest references jest-cli: ^24.5.0.
What would happen during npm install is we get jest-cli@24.6.0, which brings in jest-config@24.6.0 and babel-jest@24.6.0 which ends up in the root of node_modules, while putting babel-jest@24.5.0 inside node_modules/react-scripts/node_modules/babel-jest, and then when running CRA we get the preflight warning.
When I run npx create-react-app someapp and then run yarn start. It gave me the following error.
yarn run v1.15.2
$ 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:
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:
Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
Delete node_modules in your project folder.
Remove "babel-jest" from dependencies and/or devDependencies in the package.json file in your project folder.
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:
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.
Check if /Users/eddiechen/github/someapp/node_modules/babel-jest is outside your project directory.
For example, you might have accidentally installed something in your home folder.
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!
Resolutions didn't work for me. Any other ideas on a work around? I'm using Yarn so that might have something to do with it, but I've tried with npm as well and that just hangs at starting before it finally dies with an allocation failure.
@jdarling To run the server, as a workaround, I've been using the following command. My guess is that any command that fails you can just add SKIP_PREFLIGHT_CHECK=true before it for now.
Ok, if anyone else is still suffering make sure you delete your node_modules folder, yarn.lock (or package-lock.json) file, and clear your cache. yarn cache clear (in my case). Then do a clean install. Unfortunately for those of us on 3rd world internet connections that can mean hours of waiting.
Thanks for forcing jest down our throats and not locking versions down so it could screw us.
Thanks for forcing jest down our throats and not locking versions down so it could screw us.
That is a very unfair and unproductive statement. Most of our users are very happy with Jest. You are also free to use your own testing framework and/or eject if needed.
We are locking dependency versions down in CRA in almost all cases. However we can't control how our dependencies reference other dependency versions, and in some cases we end up in these scenarios (which we are addressing).
Also keep in mind that this project is mostly maintained by the community. We contribute to this project outside of our day jobs as it is something we're passionate about and love doing. Please keep the comments polite and constructive. Thanks!
Inflammatory yes, very unfair and unproductive, not at all. Can I install or use create-react-app without having Jest installed even though I don't use Jest, nope (statement is accurate and thus fair). On more than one occasion has Jest broke backward compatibility by not following semantic versioning rules, yes (statement is backed by historic evidence, provokes a response and thus is productive).
The testing package should be a dependency that acts as an addon like everything else, not a default.
My statement is completely accurate and I stand by it.
It is not unfair or unproductive - it just puts the finger in the wound. Jest and React are developed by Facebook and I strongly recommend an inhouse NPM registry powered CI pipeline to run against ALL projects such as Yarn, Jest, React etc. before you guys deploy to the public registry and break thousands of projects and builds.
I did a little "kind of stupid" math but it shows the scope:
4676703 downloads per week (react)
668100 downloads per day (react)
1h ~ average time to research and fix an issue like this one
668100h = 76years
36 years ~ average time of a career
congrats, 2 developers have been killed today
This project isn't Jest or React and none of the maintainers of Create React App work at Facebook. We are all volunteers working on this project in our spare time.
Activity
ianschmitz commentedon Apr 5, 2019
Here's an example we get a preflight warning in our CI. We noticed this quite a bit the last few days as Jest has released a few new versions in quick succession. Each new release would break CI.
This is an example
npm ls babel-jestoutput when everything works nicely:However when a new version of jest comes out, let's say
24.6.0, even though we pinnedjest@24.5.0andbabel-jest@24.5.0,jestreferencesjest-cli: ^24.5.0.What would happen during
npm installis we getjest-cli@24.6.0, which brings injest-config@24.6.0andbabel-jest@24.6.0which ends up in the root ofnode_modules, while puttingbabel-jest@24.5.0insidenode_modules/react-scripts/node_modules/babel-jest, and then when running CRA we get the preflight warning.minesaner commentedon Apr 8, 2019
The preflight check folder is
<rootDir>/node_modules. Maybe<scriptsVersion>/node_modulesshould be check first.yuchuan1 commentedon May 5, 2019
Jest 24.8.0 breaks it again.
When I run
npx create-react-app someappand then runyarn start. It gave me the following error.The error went away after I changed
"babel-jest": "24.7.1"to"babel-jest": "^24.7.1"in package.json of create-react-app.icyJoseph commentedon May 6, 2019
Suffering from the very same issue. Any CRA made this morning fails to start because of 24.8.0 in babel-jest. Same output as @yuchuan1
abisuq commentedon May 6, 2019
add a version resolutions into
package.jsontemporarilyUse package.json resolutions until jest versions are sorted out
russellr922 commentedon May 6, 2019
Ran into same problem today.
jdarling commentedon May 6, 2019
Resolutions didn't work for me. Any other ideas on a work around? I'm using Yarn so that might have something to do with it, but I've tried with npm as well and that just hangs at starting before it finally dies with an allocation failure.
eddiemonge commentedon May 6, 2019
Also getting this with webpack
ericvera commentedon May 7, 2019
@jdarling To run the server, as a workaround, I've been using the following command. My guess is that any command that fails you can just add
SKIP_PREFLIGHT_CHECK=truebefore it for now.SKIP_PREFLIGHT_CHECK=true yarn startjdarling commentedon May 7, 2019
Everything mentioned above results in:
Or some variant for me. Last week same code no problem, this week everything is broke.
jdarling commentedon May 7, 2019
Ok, if anyone else is still suffering make sure you delete your node_modules folder, yarn.lock (or package-lock.json) file, and clear your cache. yarn cache clear (in my case). Then do a clean install. Unfortunately for those of us on 3rd world internet connections that can mean hours of waiting.
Thanks for forcing jest down our throats and not locking versions down so it could screw us.
ianschmitz commentedon May 7, 2019
That is a very unfair and unproductive statement. Most of our users are very happy with Jest. You are also free to use your own testing framework and/or eject if needed.
We are locking dependency versions down in CRA in almost all cases. However we can't control how our dependencies reference other dependency versions, and in some cases we end up in these scenarios (which we are addressing).
Also keep in mind that this project is mostly maintained by the community. We contribute to this project outside of our day jobs as it is something we're passionate about and love doing. Please keep the comments polite and constructive. Thanks!
jdarling commentedon May 7, 2019
Inflammatory yes, very unfair and unproductive, not at all. Can I install or use create-react-app without having Jest installed even though I don't use Jest, nope (statement is accurate and thus fair). On more than one occasion has Jest broke backward compatibility by not following semantic versioning rules, yes (statement is backed by historic evidence, provokes a response and thus is productive).
The testing package should be a dependency that acts as an addon like everything else, not a default.
My statement is completely accurate and I stand by it.
henryruhs commentedon May 7, 2019
It is not unfair or unproductive - it just puts the finger in the wound. Jest and React are developed by Facebook and I strongly recommend an inhouse NPM registry powered CI pipeline to run against ALL projects such as Yarn, Jest, React etc. before you guys deploy to the public registry and break thousands of projects and builds.
I did a little "kind of stupid" math but it shows the scope:
iansu commentedon May 7, 2019
This project isn't Jest or React and none of the maintainers of Create React App work at Facebook. We are all volunteers working on this project in our spare time.