Laravel-mix: Unable to find module 'uglifyjs-webpack-plugin'

Created on 29 Jan 2018  ·  4Comments  ·  Source: JeffreyWay/laravel-mix

  • Laravel Mix Version: 2.0.0
  • Node Version (node -v): 9.4.0
  • NPM Version (npm -v): 5.6.0
  • OS: macOS 10.12.6

Description:

When running npm run dev I receive the following error:

module.js:557
    throw err;
    ^

Error: Cannot find module 'uglifyjs-webpack-plugin'
    at Function.Module._resolveFilename (module.js:555:15)
    at Function.Module._load (module.js:482:25)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/Users/anellis/Developer/TextLoop/node_modules/laravel-mix/src/builder/webpack-plugins.js:9:22)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)

Steps To Reproduce:

Using the following webpack.mix.js running the latest version of Laravel Mix results in this error.

let mix = require('laravel-mix');

mix
    .js('resources/assets/js/admin/app.js', 'public/js/admin')
    .js('resources/assets/js/agent/app.js', 'public/js/agent')
    .sass('resources/assets/sass/app.scss', 'public/css')
    .sass('resources/assets/sass/collector.scss', 'public/css');

I tried running the following to ensure a clean working slate:

rm -rf node_modules
npm cache clear --force
npm install

No luck.

Installed packages:

├── @fortawesome/[email protected]
├── @fortawesome/[email protected]
├── @fortawesome/[email protected]
├── @fortawesome/[email protected]
├── @fortawesome/[email protected]
├── @fortawesome/[email protected]
├── @fortawesome/[email protected]
├── @fortawesome/[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]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]
stale

Most helpful comment

There seems to be a problem with the latest version of the uglifyjs-webpack-plugin
https://github.com/webpack-contrib/uglifyjs-webpack-plugin/issues/217

Downgrading seems to fix it.

npm i --save-dev [email protected]

All 4 comments

There seems to be a problem with the latest version of the uglifyjs-webpack-plugin
https://github.com/webpack-contrib/uglifyjs-webpack-plugin/issues/217

Downgrading seems to fix it.

npm i --save-dev [email protected]

Thank you @Nekura. I would say leave this open until the dependency is fixed so others experiencing this issue see this for the temporary work around.

Upgrading to 1.1.8 fixed it too for me.

npm i --save-dev [email protected]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wendt88 picture wendt88  ·  3Comments

dtheb picture dtheb  ·  3Comments

RomainGoncalves picture RomainGoncalves  ·  3Comments

jpmurray picture jpmurray  ·  3Comments

Micaso picture Micaso  ·  3Comments