Laravel-mix: UNMET PEER DEPENDENCY [email protected]

Created on 9 Jan 2017  路  10Comments  路  Source: JeffreyWay/laravel-mix

When I try to install laravel-mix via
npm install laravel-mix --save-dev
I always get the following error message:
UNMET PEER DEPENDENCY [email protected]
and at the bottom:
npm WARN [email protected] requires a peer of webpack@^2.1.0-beta.19 but none was installed. npm WARN [email protected] requires a peer of webpack@^2.1.0-beta.26 but none was installed.

I run this in a fresh installation of Homestead and got into the vm via vagrant ssh.

Most helpful comment

Yeah, I'd nuke the node_modules directory and try again.

All 10 comments

@hebinet try updating your nodejs version

They're warnings, not errors. You can ignore them.

@QWp6t
This is some kind of circular dependency.
I had to fix it like this:

npm install -g webpack@^2.2.0-rc.3
npm install
npm install webpack@^2.1.0-beta.28 [email protected]

Otherwise, I couldn't use features like HMR because npm install -g webpack web-dev-server gives me webpack version 1.x

Spent like 8 hours trying to understand why HMR was not working and it because laravel-mix doesn't install webpack and it's dependencies correctly (installs webpack version 1.x for me on Ubuntu 16.04 by default using npm install -g webpack web-dev-server, but HMR doesn't actually update Vue modules). From the user standpoint, I don't want even care about the dependency packages, but without these packages, it's impossible to use the feature properly and I don't understand why it's not actually required.

It installs them correctly, sorta. See also: https://github.com/JeffreyWay/laravel-mix/issues/22#issuecomment-269700938

The issues that you're experiencing indicate that you might be using an older version of node. You should switch to yarn if you want to ensure parity with what jway uses, or at the very least update nodejs and npm to their latest stable versions.

You shouldn't have to install any of these dependencies globally. And running those install commands without specifying a version means that you'll be getting the latest releases (not pre-releases) of them. Laravel Mix uses pre-releases of webpack and webpack-dev-server, which could be another reason you were having issues.

@QWp6t

As far as I'm concerned these are the stable versions of npm and node.

$ npm -v
3.10.8
$ node -v
v6.9.1

Not latest, though. But it shouldn't be the issue. Googling this error gives a ton of links meaning there is an actual problem with webpack and webpack-dev-server packages.

Should I try to install node v7.x and npm v4.x?

Nah, you should be good with those versions afaik. As mentioned above, laravel-mix uses pre-releases of webpack and webpack-dev-server, so mixing those with globally installed releases might also be confusing things.

At this point, I'm somewhat stumped. If it were me, I'd be nuking everything and starting all over. Maybe someone else will weigh in with a better idea?

Yeah, I'd nuke the node_modules directory and try again.

I am also have this same issue....this is a bug or just a warning??????

I got this issue, too, when I install html-webpack-plugin, using 'npm i --save-dev html-webpack-plugin' command.

-- UNMET PEER DEPENDENCY [email protected]

node --version
v6.10.2
npm --version
3.10.10

"devDependencies": { "html-webpack-plugin": "^2.28.0", "webpack": "^3.0.0-rc.1" }

@cnpengwei Doesn't matter. It should not affect anything much. This is just a warning rather than an error.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

pixieaka picture pixieaka  路  3Comments

stefensuhat picture stefensuhat  路  3Comments

dtheb picture dtheb  路  3Comments

amin101 picture amin101  路  3Comments

Cheddam picture Cheddam  路  3Comments