node.js - Gatsby 在 mozjpeg 上构建失败

标签 node.js linux docker npm gatsby

从昨天开始,我无法将我的 Gatsby 站点部署到我们的服务器,build 提示 mozjpeg 库。有没有人遇到过这个错误?
我试过:

  • 锁定 gatsby-cli
  • 添加 automake linux 包
  • 添加 libtools linux 包
  • 解冻纱锁
  • 安装没有锁定文件的依赖项

  • 但似乎没有任何帮助,错误如下:
    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"
    
    操作系统
    Ubuntu 16.04.6
    Node
    12.14
    Gatsby
    2.19.7

    最佳答案

    根据一些 GitHub 线程:

  • https://github.com/JeffreyWay/laravel-mix/issues/1271
  • https://github.com/mozilla/mozjpeg/issues/244
  • https://github.com/imagemin/imagemin/issues/168

  • 他们建议:
  • 安装 nasm (强烈推荐)
  • 如果上述解决方案不起作用,请安装 automake , autoconf , libtool , dpkg , pkgconfig , libpng , libpng-dev , g++
  • 删除缓存
  • 关于node.js - Gatsby 在 mozjpeg 上构建失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64927442/

    相关文章:

    node.js - 如何使用nodejs连接我们的Jira

    javascript - 将 err 传递到express.js Router、Node.js

    Linux 从可执行 bash 文件更改目录

    linux - 查找由另一台服务器远程触发的进程

    docker - ElasticSearch 容器无法在 Docker 中启动

    docker-compose 将图像保存/加载到另一台主机

    node.js - Node Sass 找不到当前环境的绑定(bind) : Linux 64-bit with Node. js 7.x

    node.js - 为什么 NPM 可以在本地运行,但不能在 Docker 上运行?

    c - 为什么这个CPU运行速度更快?

    amazon-web-services - 是否可以在 Amazon elasticbeanstalk 上启动特权 docker 容器?