2

I am trying to create a react app with the below steps:

  1. npm install -g create-react-app
  2. create-react-app my-app
  3. cd my-app
  4. npm start

And I get this error:

enter image description here

In error have suggestion to remove webpack dependency but i cant do that because in file package.json dun have that. Here my package.json

enter image description here

For additional information:

  • i am using windows 10
  • npm 6.4.1
  • create-react-app version 2.0.3
  • node v8.12.0
Kentang
  • 110
  • 1
  • 1
  • 8

4 Answers4

1

Just do following steps:
- delete package-lock.json.
- delete node_modules.
- npm install.

Or

Just try steps mentioned in the error log and you will be fine . enter image description here

  • in package.json dont have webpack. Only have "dependencies": { "react": "^16.5.2", "react-dom": "^16.5.2", "react-scripts": "2.0.4" }, – Kentang Oct 14 '18 at 09:35
  • it's fine. After deleting (package-lock.json file + node_modules folder) and doing npm install will work just fine. No need care about webpack if it was not there. – Devender Verma Oct 14 '18 at 09:38
  • Thank for suggestion. Just now i already try - delete package-lock.json. - delete node_modules. - npm install. But Problem still appear. – Kentang Oct 14 '18 at 09:42
1

Do step number 6 and delete that babel loader or webpack folder and you will be good afterwards. Chances are you have an outdated web pack or babel that you installed in a previous project.

0

I just had this very issue, and turns out to be something simple

The part of the log that says about there being a

"a different version of webpack was detected higher up in the tree"

looks to be the same case for you. I think you may have ran npm install at some point under D:\bolehDiHapus and so have node_modules installed further up the tree that you meant.

I simply changed the name of D:\bolehDiHapus\node_modules (probably best to just delete it) and hey presto npm start works.

Community
  • 1
  • 1
verde79
  • 1
  • 1
0

I had this same issue, first it started saying we found the wrong version farther up in the tree, and then i had to delete webpack up there, and then i had install their "required version" even if it is lower than latest.

npm install webpack@version --save

in your case: npm install --save webpack@4.19.1