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

配置完装饰器之后以运行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运行就好了。

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

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

时间: 2024-08-30 15:23:55

react配置完装饰器之后运行yarn start时报错的相关文章

intellij idea运行Android程序时报错;Unable to locate adb within SDK

环境:intellij idea15 问题:运行Android时报错Throwable:Unable to locate adb within SDK 解决方法:在SDK安装目录的\platform-tools下放入adb.exe 原因:我的adb是单独安装的,是装在SDK安装目录的tools下的.我猜测Android运行时是在SDK的platform-tools下去找adb命令的.所以我只是复制了tools下的adb.exe到platform-tools下

Apache配置完虚拟主机后,使用Chrome访问localhost还是默认目录htdocs

Chrome 解析DNS出错,这个错误比较罕见,甚至说有点奇特.今天在使用Apache配置虚拟主机时,出现了一个非常奇怪的现象.我按照配置的步骤配置虚拟主机,如下 配置虚拟主机的步骤如下: 1. 启用  httpd-vhosts.conf 在 httpd.conf 文件中 # Virtual hosts ,虚拟主机 Include conf/extra/httpd-vhosts.conf 2. 在httpd-vhosts.conf文件中做配置 #配置我们自己的虚拟主机 <VirtualHost 

安装weback后,运行webpack -v报错:‘webpack’不是内部或者外部命令

最近,后端同事安装webpack后,发现命令跑不起来. 原因:这位同事安装Webpack的时候设置了全局存放路径和缓存路径为D盘,不在C盘的默认目录下. 我想可能是因为这时系统接收到Webpack命令后会去C盘找Webpack的文件解析命令,但是C盘里面没有文件,又没有告诉系统说把webpack安装文件换了位置,系统不知道,没有找到,就会跑不起来. 解决办法:设置path环境变量,告诉系统安装文件在D盘. 注意:在测试的时候,cmd命令窗一直是开的同一个,这时就算设置了环境变量,命令窗找的还是之

vue2.X版本vue-cli生成项目后运行失败,报错信息为getaddrinfo ENOTFOUND localhost

问题: 1.使用vue-cli生成项目 2.npm install 3.npm run dev,报错信息如下 解决方法: 经查,发现package.json中dev的脚本变成了"webpack-dev-server --inline --host 0.0.0.0 --progress --config build/webpack.dev.conf.js",使用了webpack-dev-server 出现此问题是因为webpack-dev-server启动时要指定ip,不能直接通过loc

IDEA 运行maven命令时报错: -Dmaven.multiModuleProjectDirectory system propery is not set

在file-setting里面,找到maven的设置: 先加入一个环境变量 然后配置一个JVM的参数: -Dmaven.multiModuleProjectDirectory=$M2_HOME OK ,问题解决!

windows下的eclipse运行hdfs程序时报错 (null) entry in command string: null chmod 0644

在Windows操作系统中使用eclipse本地运行hadoop的hdfs程序, FileSystem local = FileSystem.getLocal(conf); 使用 FSDataOutputStream out = local.create(localFile);  创建本地文件输出流时, 报以下错误:....(null) entry in command string: null chmod 0644 ..(后面是目的目录) 解决方法: 下载hadoop.dll文件 并拷贝到C:

Cloud9:解决ThinkPHP在C9上运行时连接数据库时报错&quot;No such file or directory&quot;的问题

昨天尝试在c9上部署了一个ThinkPHP用于开发,但是当试图连接数据库时却出现了这样的问题.经过查找资料发现此问题是由于没有找到mysql.sock这个文件造成的(这个东西估计是mysql的连接线程)..然后,,就苦逼了,翻来覆去改php.ini却一点效果都没有,最后找到了一个建软连接的办法,但是那个教程给的地址不适用于c9.最后实在忍无可忍就敲了一下mysql,突然跳出来一行“ERROR 2002 (HY000): Can't connect to local MySQL server th

MySQL(Navicat)运行.sql文件时报错:[Err] 2006 - MySQL server has gone away 的解决方法

Message: MySQL server has gone away 原因可能是sql语句过长,超过mysql通信缓存区最大长度: 调整mysql配置文件中max_allowed_packet 编辑mysql.ini max_allowed_packet=16M 重启mysql

myeclipse10安装了activiti插件后创建BPMN 文件时报错,

以上错误需要,下载一个补丁. 补丁地址:http://www.shareyx.com/blog/2 补丁的安装可以参考: http://jingyan.baidu.com/article/dca1fa6fba6a0af1a4405290.html 解决办法2: 看截图你myeclipse10吗,myeclipse对activiti的插件集成不怎么好. 建议用eclipse kepler以上的版本画图,或者activiti不是有web版的画图工具吗,不用插件也行