npm start error with preflight check
See original GitHub issueSo, I have a Loopback 3 Project inside geccomat - Copy
and a React App from create-react-app 2 inside geccomat - Copy\client-src
. Loopback uses it’s own dependencies, including eslint 3.19.0, whereas create-react-app uses eslint 5.6.0. Theoretically, as Loopback is an outer project, it wouldn’t affect the inner React App, but when I run npm start
for the react app, it outputs this:
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:
"eslint": "5.6.0"
Don't try to install it manually: your package manager does it automatically.
However, a different version of eslint was detected higher up in the tree:
C:\Users\G1745 IRON\Desktop\geccomat - Copy\node_modules\eslint (version: 3.19.0)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If 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 "eslint" 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 C:\Users\G1745 IRON\Desktop\geccomat - Copy\node_modules\eslint is outside your project directory.
For example, you might have accidentally installed something in your home folder.
7. Try running npm ls eslint in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed eslint.
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!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client-src@0.1.0 start-js: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client-src@0.1.0 start-js script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\G1745 IRON\AppData\Roaming\npm-cache\_logs\2018-11-16T19_45_21_488Z-debug.log
ERROR: "start-js" exited with 1.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! client-src@0.1.0 start: `set PORT=3001 && npm-run-all -p watch-css start-js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the client-src@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\G1745 IRON\AppData\Roaming\npm-cache\_logs\2018-11-16T19_45_21_826Z-debug.log
package-lock.json
for the client-src
folder has eslint 5.6.0, as expected, but it doesn’t let me run the app. I deleted both the node_modules
folders and ran npm i
again, but to no success.
I don’t know if this is exactly a bug or not, but it’s something that doesn’t make sense in my head. I may be wrong on thinking the outer dependencies won’t affect the inner dependencies, though.
It works fine with react-scripts 1.1.5
, issue being that I need to use an npm package that only gets built if I use react-scripts 2.1.1
What could I do?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8
Top GitHub Comments
I noticed this as well.
The
package.json
foreslint-config-react-app
(in thenode_modules
of thereact-scripts
directory) calls for"eslint": "5.x",
This installs eslint
5.9
… which appears to override the explicit"5.6.0"
in the main directory’spackage.json
as well asreact-script
’s package.json because it sees the package as already installed at that step I suppose.If you
yarn remove eslint
and re-doyarn install
in the main directory. It will then install eslint 5.6.0 and your preflight check should pass.It’s a little bit hack-y, but it temporarily solves the problem.
One of these changes could be adopted by the maintainers to solve the problem:
eslint-config-react-app
package.json
can be amended to be in sync with the expectations of the parent package orreact-script
’spackage.json
needs to be upgraded to5.9.0
so the preflight passes, or changed to to a more flexible5.x
orNot sure if this bug should be targeted towards the
eslint-config-react-app
or thereact-script
or thecreate-react-app
maintainers.Fixing the eslint version in
react-script
’spackage.json
and/oreslint-config-react-app
’spackage.json
does make the preflight check error message go away.Also fixed as per @agrcrobles comment, but this isn’t great as I was using a more recent version of eslint further up the project tree.
Relevant issue in react-scripts repo: https://github.com/facebook/create-react-app/issues/5933