laravel-mix: Laravel Mix error with processCssUrls:true

  • Laravel Mix Version: 0.11.4 (npm list --depth=0)
  • Node Version (node -v): 7.10.0
  • NPM Version (npm -v): 4.5.0
  • OS: Homestead on Vagrant with VBox on Windows 10

Description:

I am having an error when I try to run npm run dev with processCssUrls set to true (default). I keep getting:

 error  in ./resources/assets/less/admin/images/error-bg.jpg

Module build failed: Error: spawn /home/vagrant/Code/kin-ball-v4/node_modules/mozjpeg/vendor/cjpeg ENOENT
    at exports._errnoException (util.js:1050:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:367:16)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)

 @ ./~/css-loader?{"url":true,"sourceMap":false}!./~/postcss-loader?{"sourceMap":false}!./~/less-loader?{}!./resources/assets/less/admin/style.less 5:80838-80870
 @ ./resources/assets/less/admin/style.less
 @ multi ./~/laravel-mix/src/mock-entry.js ./resources/assets/less/admin/style.less

Module build failed: Error: spawn /home/vagrant/Code/kin-ball-v4/node_modules/optipng-bin/vendor/optipng ENOENT
    at exports._errnoException (util.js:1050:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
    at onErrorNT (internal/child_process.js:367:16)
    at _combinedTickCallback (internal/process/next_tick.js:80:11)
    at process._tickCallback (internal/process/next_tick.js:104:9)

 @ ./~/css-loader?{"url":true,"sourceMap":false}!./~/postcss-loader?{"sourceMap":false}!./~/less-loader?{}!./resources/assets/less/admin/style.less 5:106624-106660
 @ ./resources/assets/less/admin/style.less
 @ multi ./~/laravel-mix/src/mock-entry.js ./resources/assets/less/admin/style.less

I tried disabling it and it was able to build just fine… I am compiling less files btw.

Steps To Reproduce:

I am not sure, I followed the installation process… I am not sure what I am doing wrong…

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 21 (3 by maintainers)

Most upvoted comments

Seems like img-loader is causing these issues, there is a way to disable image minifications without disabling url processing in css. Check this commit

mix.options({
  processCssUrls: true,
  imgLoaderOptions: {
    enabled: false,
  }
});

Can you try above config until someone fix this issue.

I am using ubuntu 16.04 and I solved the issue by

  1. sudo apt-get install autoconf
  2. sudo apt-get install dh-autoreconf
  3. npm rebuild mozjpeg

rect4148-5

to fix this, I ran:

npm rebuild optipng-bin
npm rebuild node-sass
  1. sudo apt-get install nasm
  2. npm rebuild mozjpeg

solved the issue for me (ubuntu 16.04)