2
10:52:56 PM: There might be a problem with the project dependency tree.
10:52:56 PM: It is likely not a bug in Create React App, but something you need to fix locally.
10:52:56 PM: The react-scripts package provided by Create React App requires a dependency:
10:52:56 PM:   "babel-jest": "23.6.0"
10:52:56 PM: Don't try to install it manually: your package manager does it automatically.
10:52:56 PM: However, a different version of babel-jest was detected higher up in the tree:
10:52:56 PM:   /opt/build/repo/node_modules/babel-jest (version: 24.7.1)
10:52:56 PM: Manually installing incompatible versions is known to cause hard-to-debug issues.
10:52:56 PM: If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
10:52:56 PM: That will permanently disable this message but you might encounter other issues.
10:52:56 PM: To fix the dependency tree, try following the steps below in the exact order:
10:52:56 PM:   1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
10:52:56 PM:   2. Delete node_modules in your project folder.
10:52:56 PM:   3. Remove "babel-jest" from dependencies and/or devDependencies in the package.json file in your project folder.
10:52:56 PM:   4. Run npm install or yarn, depending on the package manager you use.
10:52:56 PM: In most cases, this should be enough to fix the problem.
10:52:56 PM: If this has not helped, there are a few other things you can try:
10:52:56 PM:   5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
10:52:56 PM:      This may help because npm has known issues with package hoisting which may get resolved in future versions.
10:52:56 PM:   6. Check if /opt/build/repo/node_modules/babel-jest is outside your project directory.
10:52:56 PM:      For example, you might have accidentally installed something in your home folder.
10:52:56 PM:   7. Try running npm ls babel-jest in your project folder.
10:52:56 PM:      This will tell you which other package (apart from the expected react-scripts) installed babel-jest.
10:52:56 PM: If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
10:52:56 PM: That would permanently disable this preflight check in case you want to proceed anyway.
10:52:56 PM: P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!

So I recently pushed a new build to my app and got the above error, something to do with babel-jest. This is not in my package.json, it must be a peer dependency or something.

The build works great locally, I have confirmed by deleting the node_modules and the package-lock.json and it all installs and runs just fine.

When I push to master, netlify logs this error and just won't move on.

2
  • I'd suggest starting with the debugging article in netlify's community: community.netlify.com/t/common-issue-debugging-site-builds/142 . You could also try a build without cache from the "trigger deploy" button on the deploy listing page, and selecting the "clear build cache" option since that might help out with peer dependencies. Commented May 10, 2019 at 19:42
  • Thanks for the advice, it turned out to be related to babel-jest version, strange problem. Commented May 10, 2019 at 20:10

2 Answers 2

2

So what fixed it for me was to search in the package-lock.json for babel-jest. I then added that version to a resolutions entry in my package.json as follows:

"resolutions": { "babel-jest": "23.6.0" }

This solved the problem and my app published correctly on Netlify.

Sign up to request clarification or add additional context in comments.

2 Comments

But what happens when the babel-jest version changes?
for the moment, you'll need to change that also, unless you have a solution?
2

I know this question is kind of old and the answer has already been chosen but the above answer doesn't work for me.So here how i solve my problem

put package-lock.json in .gitignore file but if you already uploaded it to github without mentioning it to .gitignore file then remove it from git cache(local repo)

git rm -r --cached package-lock.json
git add .
git commit -m 'Remove package-lock.json'
git push origin master

In you netlify site goto Site settings->Build & Deploy->Environment and put the following inside the environement variable

SKIP_PREFLIGHT_CHECK=true

and put the follow to Build setting->Build Command if your netlify build assume warning as error

CI=false npm run build

1 Comment

Thanks setting up CI=false npm run build worked I got fed up by the build failing

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.