Rails:Webpack-dev-server 有未满足的对等依赖 [英] Rails: Webpack-dev-server has unmet peer dependency

查看:24
本文介绍了Rails:Webpack-dev-server 有未满足的对等依赖的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在尝试使用 DockerUbuntu 18.0.4 上设置 Rails 6.0.2 应用程序.我已使用 PostgreSQL 成功设置了数据库,并通过运行以下命令安装了必要的 gem:

I am currently trying to set up a Rails 6.0.2 application on Ubuntu 18.0.4 using Docker. I have successfully set up the database using PostgreSQL and I have installed the necessary gems by running the command below:

bundle install

但是,当我尝试使用以下命令安装节点包时:

However, when I try to install the node packages using the command below:

yarn install

我收到以下消息,这让我担心有些事情不对劲:

I get the message below which gives me some concern that something is not right:

警告">webpack-dev-server@3.10.3"有未满足的对等依赖 "webpack@^4.0.0 ||^5.0.0".

warning " > webpack-dev-server@3.10.3" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".

警告 "webpack-dev-server >webpack-dev-middleware@3.7.2";具有未满足的对等依赖项webpack@^4.0.0".

warning "webpack-dev-server > webpack-dev-middleware@3.7.2" has unmet peer dependency "webpack@^4.0.0".

我尝试了一些解决方案,但没有奏效.我需要帮助.谢谢.

I have tried a few solutions but it's not working. I need some help. Thank you.

推荐答案

我是这样解决的:

只需运行以下命令即可将 yarn 版本升级到您想要的版本:

Simply run the command below to upgrade the version of yarn to your desired version:

yarn upgrade webpack@^4.0.0

注意:您可以将4.0.0替换为yarn所需的版本,例如5.0.0.

Note: You can substitute 4.0.0 with the required version for yarn, say 5.0.0.

另一种解决方案

将您想要的 webpack 版本添加到您的 package.json 文件中.这里使用的webpack版本是4.43.0:

Add the version of webpack that you want to your package.json file. Here the version of webpack used is 4.43.0:

"devDependencies": {
  "webpack": "^4.43.0",
  "webpack-dev-server": "^3.11.0"
}

然后运行yarn install来安装webpack

仅适用于 Docker 应用程序:

Dockerfile 中的 yarn install 命令之前添加命令:

Add the command just before the yarn install command in your Dockerfile:

RUN yarn upgrade webpack@^4.0.0 \
    yarn install

在 GitHub 上参考:未满足的对等依赖项

Reference to this on GitHub: Unmet peer dependencies

仅此而已.

我希望这会有所帮助.

这篇关于Rails:Webpack-dev-server 有未满足的对等依赖的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆