Jenkins构建无法安装pngquant

时间:2018-04-07 04:16:52

标签: docker jenkins webpack build

我在Docker中运行此Jenkins Image

在我的一个版本中,我尝试安装以下软件包: json "devDependencies": { "@babel/core": "^7.0.0-beta.40", "@babel/preset-env": "^7.0.0-beta.40", "babel-loader": "^8.0.0-beta.0", "css-loader": "^0.28.11", "file-loader": "^1.1.11", "html-webpack-plugin": "^3.1.0", "image-webpack-loader": "^4.2.0", "node-sass": "^4.8.3", "sass-loader": "^6.0.7", "style-loader": "^0.20.3", "webpack": "^4.0.1", "webpack-cli": "^2.0.13", "webpack-dev-server": "^3.1.1" }

但是,在尝试安装pngquant-bin@4.0.0时,构建仍然失败:

> node-sass@4.8.3 install /var/jenkins_home/workspace/crypto-coaster/node_modules/node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.8.3/linux-x64-57_binding.node
Download complete
Binary saved to /var/jenkins_home/workspace/crypto-coaster/node_modules/node-sass/vendor/linux-x64-57/binding.node
Caching binary to /var/jenkins_home/.npm/node-sass/4.8.3/linux-x64-57_binding.node

> cwebp-bin@4.0.0 postinstall /var/jenkins_home/workspace/crypto-coaster/node_modules/cwebp-bin
> node lib/install.js

  ✔ cwebp pre-build test passed successfully

> gifsicle@3.0.4 postinstall /var/jenkins_home/workspace/crypto-coaster/node_modules/gifsicle
> node lib/install.js

  ✔ gifsicle pre-build test passed successfully

> mozjpeg@5.0.0 postinstall /var/jenkins_home/workspace/crypto-coaster/node_modules/mozjpeg
> node lib/install.js

  ✔ mozjpeg pre-build test passed successfully

> optipng-bin@3.1.4 postinstall /var/jenkins_home/workspace/crypto-coaster/node_modules/optipng-bin
> node lib/install.js

  ✔ optipng pre-build test passed successfully

> pngquant-bin@4.0.0 postinstall /var/jenkins_home/workspace/crypto-coaster/node_modules/pngquant-bin
> node lib/install.js

  ⚠ The `/var/jenkins_home/workspace/crypto-coaster/node_modules/pngquant-bin/vendor/pngquant` binary doesn't seem to work correctly
  ⚠ pngquant pre-build test failed
  ℹ compiling from source
  ✔ pngquant pre-build test passed successfully
  ✖ Error: pngquant failed to build, make sure that libpng-dev is installed
    at Promise.all.then.arr (/var/jenkins_home/workspace/crypto-coaster/node_modules/pngquant-bin/node_modules/bin-build/node_modules/execa/index.js:231:11)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

我已经更新了Docker镜像,尝试了不同版本的Node(7.9.0,8.11.1)并继续遇到同样的错误。

不知道如何修复get pngquant-bin正在使用此版本。

非常感谢任何协助。

1 个答案:

答案 0 :(得分:3)

根据这个问题https://github.com/imagemin/pngquant-bin/issues/78。 我使用这个dockerfile来创建一个新的图像,它工作正常。

FROM jenkins/jenkins:lts
USER root
RUN apt-get update && apt-get install -y gcc make libpng-dev
USER jenkins