码迷,mamicode.com
首页 > 其他好文 > 详细

react配置完装饰器之后运行yarn start时报错

时间:2019-10-06 00:08:59      阅读:418      评论:0      收藏:0      [点我收藏+]

标签:future   exp   eps   文件   yar   RoCE   添加   document   example   

 配置完装饰器之后以运行yarn start就报错

There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locall
y.

The react-scripts package provided by Create React App requires a dependency:

"webpack": "4.41.0"

Don‘t try to install it manually: your package manager does it automatically.
However, a different version of webpack was detected higher up in the tree:

D:\react项目\darengou\node_modules\webpack (version: 4.40.2)

Manually installing incompatible versions is known to cause hard-to-debug issues
.

If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .e
nv file in your project.
That will permanently disable this message but you might encounter other issues.


To fix the dependency tree, try following the steps below in the exact order:

1. Delete package-lock.json (not package.json!) and/or yarn.lock in your proje
ct folder.
2. Delete node_modules in your project folder.
3. Remove "webpack" from dependencies and/or devDependencies in the package.js
on 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 st
eps with it instead.
This may help because npm has known issues with package hoisting which may
get resolved in future versions.

6. Check if D:\react项目\xxx名称\node_modules\webpack is outside your project
directory.
For example, you might have accidentally installed something in your home f
older.

7. Try running npm ls webpack in your project folder.
This will tell you which other package (apart from the expected react-scrip
ts) installed webpack.

If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your pro
ject.
That would permanently disable this preflight check in case you want to proceed
anyway.

P.S. We know this message is long but please read the steps above :-) We hope yo
u find them helpful!

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this comm
and.

 

解决方法:

创建一个名为 .env 的文件 ,在文件里添加SKIP_PREFLIGHT_CHECK=true 这句代码,保存再yarn start运行就好了。

虽然不知道为什么但是亲测有效!!!

 

react配置完装饰器之后运行yarn start时报错

标签:future   exp   eps   文件   yar   RoCE   添加   document   example   

原文地址:https://www.cnblogs.com/minus1994/p/11626003.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!