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

  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这样就欧克了
如有帮到你,在下面评论 “完美” 谢谢,为了以后帮助后面的同学不走弯路,如果说不行的话,希望在下面评论,我也会及时回复的。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值