Laravel-mix: npm install not installing webpack

Created on 23 Apr 2018  ยท  8Comments  ยท  Source: JeffreyWay/laravel-mix

  • Laravel Mix Version: 2.1.11 (npm list --depth=0)
  • Node Version (node -v): 9.11.1
  • NPM Version (npm -v): 5.8.0
  • OS: macOS 10.12.6

    Description:

Can't seem to be able to run any of the npm scripts.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ development: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/gdarends/.npm/_logs/2018-04-23T12_39_54_587Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ watch: `npm run development -- --watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Checking installed dependencies (npm list --depth=1) shows the following: (note the UNMET PEER DEPENDENCY)

โ”œโ”€โ”ฌ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected] deduped
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ UNMET PEER DEPENDENCY [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ”œโ”€โ”€ [email protected]
โ”‚ โ””โ”€โ”€ [email protected]

Steps To Reproduce:

npm install
npm run dev

running npm install [email protected] solves the issue.
I also checked node_modules/laravel-mix/package.json, and it contains the webpack dependency. So not sure why it's not installing.

Most helpful comment

Just tried yarn install instead, and that works fine.

All 8 comments

Just tried yarn install instead, and that works fine.

Having the same issue, except I'm not getting babel-loader either. Strange.

mine was a bad lock file, so resolved for me.

Seems that was the case for me as well.

Can you please explain what is a bad lock file and how did you resolve the problem?

@kokotonev the lock file is package-lock.json. You can remove it and reinstall your dependencies with the following commands. These commands should be run from the root directory of your project.

rm package-lock.json && rm -R node_modules
npm install

@robbyrice thank you for the explanation! Actually, I managed to solve the problem in a different way. I ran npm update and then npm install again and this solved the issue for me and it installed the missing peer dependencies (which were webpack and webpack-dev-server). I still don't know why this happened though, because the same repo works fine without npm update on my colleagues' computers...

You're welcome. I'm glad you were able to solve the issue. My knowledge of NPM is fairly limited and I'm not too sure why it works the way it does sometimes. I've had something similar happen before, but it usually involved updating a package to a new major version. :shrug:

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Micaso picture Micaso  ยท  3Comments

wendt88 picture wendt88  ยท  3Comments

hasnatbabur picture hasnatbabur  ยท  3Comments

kpilard picture kpilard  ยท  3Comments

rlewkowicz picture rlewkowicz  ยท  3Comments