在子位置运行时,react-scripts父文件夹node_modules错误

在运行react-scripts时,在具有自己的(Create-React-App)(c:\Repos\web_app1\api_ui)文件夹等子文件夹package.json中构建node_modules,我得到以下错误:

 react-scripts build


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 locally.

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

  "babel-loader": "8.0.4"

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

  c:\Repos\web_app1\node_modules\babel-loader (version: 7.1.4)
  • 不能将父文件夹的(c:\Repos\web_app1) babel-loader更新到v8.0.4 ,因为web_app1取决于 babel-loader v7.1.4 >
  • 不能删除c:\ Repos \ web_app1中的node_modules。这是父应用程序,需要自己的node_modules
  • 我的解决方法是将SKIP_PREFLIGHT_CHECK=true添加到.env文件中。这似乎是一种黑客行为,我想进行另一项修复,涉及通过预检检查进行构建。
  • 子文件夹(c:\Repos\web_app1\api_ui)中的package-lock.json具有正确的 babel-loader版本(8.0.4),为什么要转到父文件夹?

在子文件夹中构建反应脚本时,是否可以忽略父文件夹或更高的树node_modules

hb51688 回答:在子位置运行时,react-scripts父文件夹node_modules错误

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3026911.html

大家都在问