2020-01-17

npm build 报错:Module build failed: Error:

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-4af4ad4d","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/introduction/introduction.vue 2:171-214
 @ ./src/components/introduction/introduction.vue
 @ ./src/router/index.js
 @ ./src/main.js

ERROR in ./src/assets/musicPlayer/bigImg.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-0f6c2550","hasScoped":false,"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-cyclopedia/myaudio.vue 1:183-229
 @ ./src/components/sleep-cyclopedia/myaudio.vue
 @ ./node_modules/babel-loader/lib!./node_modules/vux-loader/src/script-loader.js!./node_modules/vue-loader/lib/selector.js?type=script&index=0!./src/components/sleep-cyclopedia/content.vue
 @ ./src/components/sleep-cyclopedia/content.vue
 @ ./src/router/index.js
 @ ./src/main.js

  Build failed with errors.

网上的解决方案

  1. 删除 node_modules重新install,然后build
  2. npm rebuild

方法一不行
方法二如果报如下错误:

  ✖ Error: Command failed: /bin/sh -c ./configure --enable-static --disable-shared --disable-dependency-tracking --with-jpeg8  --prefix="/home/jenkins/workspace/upload_html5_industry_all/HTML5/industry/healthRecord/node_modules/mozjpeg/vendor" --bindir="/home/jenkins/workspace/upload_html5_industry_all/HTML5/industry/healthRecord/node_modules/mozjpeg/vendor" --libdir="/home/jenkins/workspace/upload_html5_industry_all/HTML5/industry/healthRecord/node_modules/mozjpeg/vendor"
./configure: line 13633: PKG_PROG_PKG_CONFIG: command not found
./configure: line 13812: syntax error near unexpected token `libpng,'
./configure: line 13812: `PKG_CHECK_MODULES(libpng, libpng, HAVE_LIBPNG=1,'

解决方法:apt install pkg-config nasm
然后重新rebuild就ok了

你可能感兴趣的:(2020-01-17)