Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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: "webpack": "4.19.1" #5972

Closed
loicquirion opened this issue Dec 6, 2018 · 6 comments

Comments

@loicquirion
Copy link

Hi guys! I can't start my react app, I always get this error message even if I tried the steps:

C:\Users\loicq\Desktop\Coding\react\diablo-mvp>npm start

[email protected] start C:\Users\loicq\Desktop\Coding\react\diablo-mvp
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:

"webpack": "4.19.1"

Don't try to install it manually: your package manager does it automatically.
However, a different version of webpack was detected higher up in the tree:

C:\Users\loicq\node_modules\webpack (version: 4.27.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 "webpack" 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 C:\Users\loicq\node_modules\webpack is outside your project directory.
    For example, you might have accidentally installed something in your home folder.

  3. Try running npm ls webpack in your project folder.
    This will tell you which other package (apart from the expected react-scripts) installed webpack.

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! [email protected] start: react-scripts start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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\loicq\AppData\Roaming\npm-cache_logs\2018-12-06T03_16_34_961Z-debug.log

C:\Users\loicq\Desktop\Coding\react\diablo-mvp>

@Timer
Copy link
Contributor

Timer commented Dec 6, 2018

Hmm, did you really try the steps?

The message states this is because of a dependency in your home directory -- is this installation of webpack intentional?

C:\Users\loicq\node_modules\webpack

If no, please delete this folder: C:\Users\loicq\node_modules

@loicquirion
Copy link
Author

The first time I deleted node_modules using rimraf on my windows command line, was it the right way or I need to delete it directly on my desktop folder?

@Timer
Copy link
Contributor

Timer commented Dec 6, 2018

Delete it in Windows Explorer. Be sure you're deleting C:\Users\loicq\node_modules -- it has nothing to do with your project folder.

@loicquirion
Copy link
Author

Got it! Thanks a lot, really appreciated!

@wilau2
Copy link

wilau2 commented Dec 11, 2018

#5838
#4167

@hanis-salam
Copy link

go to your package.json
replace "react-scripts": "whatever ver u got" to "react-scripts": "1.1.4",
then run npm install, after that npm start

@lock lock bot locked and limited conversation to collaborators Jan 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants