- 当你按照步骤来创建react,发现到了最后一步 npm start运行不了。
- 回去看提示
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
这样就欧克了
如有帮到你,在下面评论 “完美” 谢谢,为了以后帮助后面的同学不走弯路,如果说不行的话,希望在下面评论,我也会及时回复的。