0

I am trying to install react using this command: npx create-react-app .

Then I tried to run using this command: npm run start

Then I get this error:

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-dev-server": "3.10.3"

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

  C:\Users\oa\Desktop\node_modules\webpack-dev-server (version: 3.11.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.

As suggested here [https://stackoverflow.com/questions/42308879/npm-err-code-elifecycle][1] , I have tried to fix it using the following commands:

delete package-lock.json
npm cache clean --force
npm install
npm start 

But did not fixed for me.

Just to let you know, my npm version is 6.13.6, and node version is v13.8.0

5
  • I think there is already a node_module in C:\Users\oa\Desktop\ try creating a folder for the app Commented Jun 20, 2020 at 16:11
  • Try npm i -D [email protected] in your react directory Commented Jun 20, 2020 at 16:12
  • Thanks for your comment, but I already created a separate folder for the new app Commented Jun 20, 2020 at 16:13
  • thanks @Son Nguyen. I get same error :( Commented Jun 20, 2020 at 16:17
  • Switch to C:\Users\oa\Desktop and do the same command. if not work then continue npm remove webpack-dev-server Commented Jun 20, 2020 at 16:23

3 Answers 3

2

Try to create a .env file in the root directory of the project and add this line SKIP_PREFLIGHT_CHECK=true inside the file.

then try to run yarn start or npm start.

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

1 Comment

Thanks this work for me :) Can you explain to me what was happening
0

Did you give a project name after npx create-react-app 'appName' ?

Comments

0

If you have multiple node_modules folders with different versions of dependencies one may conflict with the other - do the following:

  1. Follow steps 1-4 that are initially provided in project directory and commit updated changes locally~

i. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.

ii. Delete node_modules in your project folder.

iii. Remove "webpack" from dependencies and/or devDependencies in the package.json file in your project folder.

iv. Run npm install or yarn, depending on the package manager you use.

  1. Find the location of the node_modules folder that is not in your project folder ~ this line - (C:\Users\oa\Desktop\node_modules\webpack-dev-server)

  2. Go there and delete it

  3. once done try npm start

should work :)!

Comments

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.