NodeBB git:(v1.10.x) npm i sharp
> sharp@0.28.0 install /Users/wdxmm/workspace/NodeBB/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
sharp: Downloading https://npm.taobao.org/mirrors/sharp-libvips/v8.8.1/libvips-8.10.6-darwin-x64.tar.br
sharp: Prebuilt libvips 8.10.6 binaries are not yet available for darwin-x64
sharp: Attempting to build from source via node-gyp but this may fail due to the above error
sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
LIBTOOL-STATIC Release/nothing.a
TOUCH Release/obj.target/libvips-cpp.stamp
CXX(target) Release/obj.target/sharp/src/common.o
../src/common.cc:24:10: fatal error: 'vips/vips8' file not found
#include <vips/vips8>
^~~~~~~~~~~~
1 error generated.
make: *** [Release/obj.target/sharp/src/common.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 19.3.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/wdxmm/workspace/NodeBB/node_modules/sharp
gyp ERR! node -v v14.16.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN ajv-keywords@3.5.2 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-airbnb-base@12.1.0 requires a peer of eslint@^4.9.0 but none is installed. You must install peer dependencies yourself.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.28.0 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp@0.28.0 install 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/wdxmm/.npm/_logs/2021-04-12T07_56_39_775Z-debug.log
我真的是試了巨多方法
一、配置download代理豆胸,使用淘寶鏡像奥洼,不行,download的地址404
npm config set sharp_binary_host "[https://npm.taobao.org/mirrors/sharp](https://npm.taobao.org/mirrors/sharp)"
npm config set sharp_libvips_binary_host "[https://npm.taobao.org/mirrors/sharp-libvips](https://npm.taobao.org/mirrors/sharp-libvips)"
npm install sharp
二晚胡、手動(dòng)下載sharp-libvips到.npm/.libvips
下載log信息對(duì)應(yīng)的sharp-libvips版本到相應(yīng)的目錄中去灵奖,還是不能下載
三、最終估盘,我終于反應(yīng)過來(lái)瓷患,可能是package.json對(duì)應(yīng)的sharp版本過低,導(dǎo)致對(duì)應(yīng)的sharp-libvips也無(wú)法下載遣妥,果然擅编,修改sharp版本后一切都正常了
最終我發(fā)現(xiàn),我一開始下載的nodeBB版本就太舊了箫踩,果然一開始就努力錯(cuò)了