Delete package-lock.json (not package.json!) and/or yarn.lock in your React的小技巧

2020-08-14 13:08:38
  1. 當你按照步驟來建立react,發現到了最後一步 npm start執行不了。
  2. 回去看提示
 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:

  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\lushu\node_modules\webpack is outside your project directory.
     For example, you might have accidentally installed something in your home folder.

  7. Try running npm ls webpack in your project folder.
     This will tell you which other package (apart from the expected react-
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.

看着,首先要學會解決問題,這是官方給出的答案,但是呢只要執行最後一步就可

首先建立一個資料夾.env 檔案當然寫在你的my-app下面 下麪了
之後在裏面寫入 SKIP_PREFLIGHT_CHECK=true這樣就歐克了
如有幫到你,在下面 下麪評論 「完美」 謝謝,爲了以後幫助後面的同學不走彎路,如果說不行的話,希望在下面 下麪評論,我也會及時回覆 回復的。