tcoopman / image-webpack-loader

Image loader module for webpack

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Module build failed: Error: spawn ENOENT

RicoLiu opened this issue · comments

OS: Ubuntu 18.04.3

npm install error log:

ERROR in ./src/assets/music/img.png
Module build failed: Error: spawn /home/jenkins/workspace/upload_html5_industry_all/HTML5/industry/healthRecord/node_modules/mozjpeg/vendor/cjpeg ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:247:19)
    at onErrorNT (internal/child_process.js:429:16)
    at processTicksAndRejections (internal/process/task_queues.js:81:17)
 @ ./node_modules/vue-loader/lib/template-compiler?{"id":"data-v-561de9de","hasScoped":true,"transformToRequire":{"video":["src","poster"],"source":"src","img":"src","image":"xlink:href"},"buble":{"transforms":{}}}!./node_modules/vux-loader/src/before-template-compiler-loader.js!./node_modules/vux-loader/src/template-loader.js!./node_modules/vue-loader/lib/selector.js?type=template&index=0!./src/components/sleep-music/sleepMusicPlayerPanel.vue 1:178-224
 @ ./src/components/sleep-music/sleepMusicPlayerPanel.vue
 @ ./src/router/index.js
 @ ./src/main.js�[39m�[22m

How to fix it?

I am actually using WSL on Windows on Ubuntu and had the same issue. It looks like I was able to solve it as follows.

  1. Install missing libraries (reference:imagemin/cwebp-bin#31):
sudo apt-get update && sudo apt-get install -y libglu1
  1. New installation of all packages:
rm -rf node_modules && npm install
  1. In case the postinstall checks of cwebp-bin, gifsicle, mozjpeg, optipng-bin or pngquant-bin still fails or you get an webpack error running npm run build or npm run start try a rebuild of the packages (reference: imagemin/optipng-bin#84 (comment)):
npm rebuild

I am actually using WSL on Windows on Ubuntu and had the same issue. It looks like I was able to solve it as follows.

  1. Install missing libraries (reference:imagemin/cwebp-bin#31):
sudo apt-get update && sudo apt-get install -y libglu1
  1. New installation of all packages:
rm -rf node_modules && npm install
  1. In case the postinstall checks of cwebp-bin, gifsicle, mozjpeg, optipng-bin or pngquant-bin still fails or you get an webpack error running npm run build or npm run start try a rebuild of the packages (reference: imagemin/optipng-bin#84 (comment)):
npm rebuild

Thanks. it works