从昨天起我无法将我的Gatsby站点部署到我们的服务器上,build正在抱怨mozjpeg库。以前有人遇到过这个错误吗?
我试过:
gatsby-cli
automake linux包
libtools linux package
但似乎没有任何帮助,错误如下:
error /node_modules/mozjpeg: Command failed.
Exit code: 1
Command: node lib/install.js
Arguments:
Directory: /node_modules/mozjpeg
Output:
⚠ spawn /node_modules/mozjpeg/vendor/cjpeg ENOENT
⚠ mozjpeg pre-build test failed
ℹ compiling from source
✖ Error: Command failed: /bin/sh -c ./configure --enable-static --disable-shared --disable-dependency-tracking --with-jpeg8 --prefix="/node_modules/mozjpeg/vendor" --bindir="/node_modules/mozjpeg/vendor" --libdir="/node_modules/mozjpeg/vendor"OS Ubuntu 16.04.6 Node 12.14 Gatsby 2.19.7
发布于 2020-11-20 10:19:33
根据一些GitHub线程:
他们建议:
安装recommended)
g++
automake、autoconf、libtool、dpkg、pkgconfig、libpng、libpng-dev、g++
H 226F 227发布于 2021-02-03 09:15:57
当使用停靠器GitLab部署到image: "node:lts-alpine"页面时,也会出现同样的问题。它失败了,因为yarn:install无法构建mozjpeg。
/builds/my_project/gatsby/node_modules/mozjpeg:
错误命令失败。
要修复它,请将这些行添加到.gitlab-ci.yml中
before_script:
- apk add make nasm autoconf automake libtool dpkg pkgconfig libpng libpng-dev g++预期结果
[4/4] Building fresh packages...
Done in 170.33s.
Saving cache for successful job
00:27
Creating cache master-1...
node_modules/: found 82747 matching files and directories
WARNING: .cache/: no matching files
WARNING: public/: no matching files
Uploading cache.zip to https://storage.googleapis.com/gitlab-com-runners-cache/project/...
Created cache
Cleaning up file based variables
00:01
Job succeeded实际效果
[4/4] Building fresh packages...
error /builds/my_project/gatsby/node_modules/mozjpeg: Command failed.
Exit code: 1
Command: node lib/install.js
Arguments:
Directory: /builds/my_project/gatsby/node_modules/mozjpeg
Output:
⚠ spawn /builds/my_project/gatsby/node_modules/mozjpeg/vendor/cjpeg ENOENT
⚠ mozjpeg pre-build test failed
ℹ compiling from source
✖ Error: Command failed: /bin/sh -c autoreconf -fiv
/bin/sh: autoreconf: not found
at /builds/my_project/gatsby/node_modules/bin-build/node_modules/execa/index.js:231:11
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async Promise.all (index 0)
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
Cleaning up file based variables
00:01
ERROR: Job failed: exit code 1环境
OS信息来自:image: "node:lts-alpine"
package.json信息:
npmPackages:
gatsby: ^2.31.1 => 2.31.1
gatsby-image: ^2.10.0 => 2.10.0
gatsby-plugin-manifest: ^2.11.0 => 2.11.0
gatsby-plugin-material-ui: ^2.1.10 => 2.1.10
gatsby-plugin-offline: ^3.9.0 => 3.9.0
gatsby-plugin-react-helmet: ^3.9 => 3.9.0
gatsby-plugin-sharp: ^2.13.4 => 2.13.4
gatsby-source-filesystem: ^2.10.0 => 2.10.0
gatsby-theme-firebase: ^1.0.10 => 1.0.10
gatsby-transformer-sharp: ^2.11.0 => 2.11.0
npmGlobalPackages:
gatsby-cli: 2.17.0发布于 2021-01-10 01:57:00
我刚在一个Dockerfile里读了同一篇关于阿尔卑斯山的文章。事实证明,它所需要的是您通常需要从源代码构建的所有东西。阿尔卑斯有一个名为alpine-apk的包,我将其添加到Dockerfile中。这解决了我在mozjpeg中遇到的所有后续问题。我意识到原来的海报不是用阿尔卑斯山写的,但我想把它贴到某个地方,这样另一个有这个问题的人就有了。
https://stackoverflow.com/questions/64927442
复制相似问题