Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rails: Webpack-dev-server has unmet peer dependency

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:

warning " > [email protected]" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".

warning "webpack-dev-server > [email protected]" 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.

like image 639
Promise Preston Avatar asked May 02 '20 20:05

Promise Preston


1 Answers

Here's how I solved:

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

yarn upgrade webpack@^4.0.0

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

Another Solution

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

And then run yarn install to install webpack

For Docker Applications only:

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

RUN yarn upgrade webpack@^4.0.0 \
    yarn install

Reference to this on GitHub: Unmet peer dependencies

That's all.

I hope this helps.

like image 174
Promise Preston Avatar answered Oct 19 '22 10:10

Promise Preston