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.

Revisit dependency pinning

See original GitHub issue

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.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:18
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

15reactions
yuchuan1commented, May 5, 2019

Jest 24.8.0 breaks it again.

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:

/Users/eddiechen/github/someapp/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:

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

  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!

error Command failed with exit code 1.

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.

4reactions
icyJosephcommented, 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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Should you Pin your JavaScript Dependencies?
If instead you "pin" your dependencies rather than use ranges, it means you use exact entries like "foobar": "1.1. 0" which means "use...
Read more >
Should I be pinning my dependencies? - Packaging
The recent threads on PEP665 got me wondering whether I should revisit my decision not to pin dependencies when I distribute Python ...
Read more >
Dependency Pinning Guide - EasyPost
Dependency Pinning Guide. This guide will show you how to pin a specific version of a dependency in your application. This guide will...
Read more >
To pin or not to pin dependencies: reproducible vs. reusable ...
One camp was proposing explicitly listing which version of a dependency is required (a scheme also referred to "pinning") and the other camp ......
Read more >
How should you pin dependencies and why? – The Guild
Nevertheless pinning still has a big advantage even when the failure is not caught in time: instead of randomly looking for which dependency...
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