简体   繁体   中英

npm start not working after create-react-app

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:

在此处输入图片说明

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

在此处输入图片说明

For additional information:

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

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 . 在此处输入图片说明

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.

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM