mozjpeg pre-build test failed.系统是MacOS 11.2.3,m1的

 

>mozjpeg@7.0.0 postinstall /Users/qingqing/site-home/admin/node_modules/mozjpeg
> node lib/install.js

  ⚠ connect ECONNREFUSED 0.0.0.0:443
  ⚠ mozjpeg pre-build test failed
  ℹ compiling from source
  ✖ Error: Command failed: /bin/sh -c autoreconf -fiv
/bin/sh: autoreconf: command not found


    at /Users/qingqing/site-home/admin/node_modules/bin-build/node_modules/execa/index.js:231:11
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async Promise.all (index 0)
npm WARN rc-picker@2.5.10 requires a peer of dayjs@^1.8.30 but none is installed. You must install peer dependencies yourself.
npm WARN @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.13.12 requires a peer of @babel/core@^7.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.21.0 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mozjpeg@7.0.0 postinstall: `node lib/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the mozjpeg@7.0.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/qingqing/.npm/_logs/2021-03-23T01_27_54_160Z-debug.log

有人遇到安装mozjpeg失败的解决办法吗

 

brew 提前安装好mozjpeg相关的工具。终端代理开一下,下载github上的资源网络请求不到报错,或者把install脚本的catch里面改掉不让他走编译

如果是macOS的话,通过brew把mozjpeg相关依赖装好:

brew install libtool automake autoconf nasm

此时重新安装 mozjpeg 应该就可以通过了。

实在不行把项目依赖删了重装

rm -rf node_modules
npm cache clean --force
npm install