Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/55.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 如何从默认设置中修复这些依赖性问题;rails新应用程序";及;npx创建反应应用程序“;?_Ruby On Rails_Webpack_Node Modules_Create React App_Webpacker - Fatal编程技术网

Ruby on rails 如何从默认设置中修复这些依赖性问题;rails新应用程序";及;npx创建反应应用程序“;?

Ruby on rails 如何从默认设置中修复这些依赖性问题;rails新应用程序";及;npx创建反应应用程序“;?,ruby-on-rails,webpack,node-modules,create-react-app,webpacker,Ruby On Rails,Webpack,Node Modules,Create React App,Webpacker,我正在尝试使用默认设置创建一个新的rails应用程序,并在其中为使用npx create react应用程序的客户端创建一个文件夹。出于某种原因,所有的安装都很好,但我不明白为什么网页版本号与我的默认版本不匹配。每次我在客户端文件夹中刻录cd并尝试启动时,都会出现此错误 为了澄清,我的npx创建react应用程序客户端在myapp文件夹中运行…因此react当前位于…/Users/JohnnyBrown/Desktop/myapp/client中 我不明白我是如何在默认命令下出现网页版本问题的

我正在尝试使用默认设置创建一个新的rails应用程序,并在其中为使用npx create react应用程序的客户端创建一个文件夹。出于某种原因,所有的安装都很好,但我不明白为什么网页版本号与我的默认版本不匹配。每次我在客户端文件夹中刻录cd并尝试启动时,都会出现此错误

为了澄清,我的npx创建react应用程序客户端在myapp文件夹中运行…因此react当前位于…/Users/JohnnyBrown/Desktop/myapp/client中

我不明白我是如何在默认命令下出现网页版本问题的

在终端中使用-v时,以下是我的所有版本号:

rails版本6.0, 纱线v-1.17.0, npm-V6.9.0, 节点-v10.13.0 网页包-V4.34.0

我已经尝试过它提供的选项,即删除树上的内容,但这不起作用。。至少我连.env文件都不能用也许我放错地方了?如有任何见解,将不胜感激

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:

  "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:

  /Users/JohnnyBrown/Desktop/myapp/node_modules/webpack (version: 4.41.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 .env 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 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 /Users/JohnnyBrown/Desktop/myapp/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-scripts) installed webpack.

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

检查项目文件夹外是否没有节点模块。。您必须删除它并再次运行“npm启动”