首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Gatsby在mozjpeg上构建失败

Gatsby在mozjpeg上构建失败
EN

Stack Overflow用户
提问于 2020-11-20 10:05:41
回答 3查看 6.4K关注 0票数 4

从昨天起我无法将我的Gatsby站点部署到我们的服务器上,build正在抱怨mozjpeg库。以前有人遇到过这个错误吗?

我试过:

gatsby-cli

  • adding

  • 锁定automake linux包

  • 添加libtools linux package

  • unfreezing纱线lock

  • installing依赖关系而没有锁文件

但似乎没有任何帮助,错误如下:

代码语言:javascript
复制
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

EN

回答 3

Stack Overflow用户

回答已采纳

发布于 2020-11-20 10:19:33

根据一些GitHub线程:

他们建议:

安装recommended)

  • If (高度g++

  • Remove )上面的解决方案不起作用,安装automakeautoconflibtooldpkgpkgconfiglibpnglibpng-devg++

  • Remove缓存H 226F 227
票数 12
EN

Stack Overflow用户

发布于 2021-02-03 09:15:57

当使用停靠器GitLab部署到image: "node:lts-alpine"页面时,也会出现同样的问题。它失败了,因为yarn:install无法构建mozjpeg

/builds/my_project/gatsby/node_modules/mozjpeg:

错误命令失败。

要修复它,请将这些行添加到.gitlab-ci.yml

代码语言:javascript
复制
before_script:
   - apk add make nasm autoconf automake libtool dpkg pkgconfig libpng libpng-dev g++

预期结果

代码语言:javascript
复制
[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

实际效果

代码语言:javascript
复制
[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信息:

代码语言:javascript
复制
  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
票数 1
EN

Stack Overflow用户

发布于 2021-01-10 01:57:00

我刚在一个Dockerfile里读了同一篇关于阿尔卑斯山的文章。事实证明,它所需要的是您通常需要从源代码构建的所有东西。阿尔卑斯有一个名为alpine-apk的包,我将其添加到Dockerfile中。这解决了我在mozjpeg中遇到的所有后续问题。我意识到原来的海报不是用阿尔卑斯山写的,但我想把它贴到某个地方,这样另一个有这个问题的人就有了。

票数 -1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64927442

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档