我正尝试在macOS Ventura上为我的盖茨比项目运行npm安装。
sh -c(节点安装/libvips &&节点安装/dll复制&&预构建安装)||(节点-gyp重建&&节点安装/dll-copy)
我已经浏览了所有与此错误相关的票证并尝试修复。例如,我尝试删除tar.br文件(之前的帖子有tar.bg),通过HomeBrew安装vips,通过npm和sharp安装sharp(npm失败了,但经过一些修补后yarn工作正常)。
我有node版本18.9和sharp版本0.31.1。这是我在包.json中设置的:“gatsby-插件-夏普”:“^2.3.5”,“加茨比-变压器-锐”:“^2.3.7”
任何帮助都很感激!非常感谢!!
错误似乎来自gatsby-transformer-sharp模块:
npm ERR! code 1
npm ERR! path /Users/seanshe/Desktop/bdab_website/node_modules/gatsby-transformer-sharp/node_modules/sharp
npm ERR! command failed
npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
npm ERR! CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
npm ERR! LIBTOOL-STATIC Release/nothing.a
npm ERR! TOUCH Release/obj.target/libvips-cpp.stamp
npm ERR! CXX(target) Release/obj.target/sharp/src/common.o
npm ERR! info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.10.5/libvips-8.10.5-darwin-arm64v8.tar.br
npm ERR! ERR! sharp Prebuilt libvips 8.10.5 binaries are not yet available for darwin-arm64v8
npm ERR! info sharp Attempting to build from source via node-gyp but this may fail due to the above error
npm ERR! info sharp Please see https://sharp.pixelplumbing.com/install for required dependencies
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.3.0
npm ERR! gyp info using node@19.4.0 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.10.9 found at "/opt/homebrew/opt/python@3.10/bin/python3.10"
npm ERR! gyp info spawn /opt/homebrew/opt/python@3.10/bin/python3.10
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! gyp info spawn args '-f',
npm ERR! gyp info spawn args 'make',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/seanshe/Desktop/bdab_website/node_modules/gatsby-transformer-sharp/node_modules/sharp/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/seanshe/Library/Caches/node-gyp/19.4.0/include/node/common.gypi',
npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/seanshe/Library/Caches/node-gyp/19.4.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/seanshe/Library/Caches/node-gyp/19.4.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/seanshe/Desktop/bdab_website/node_modules/gatsby-transformer-sharp/node_modules/sharp',
npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! gyp info spawn args '--depth=.',
npm ERR! gyp info spawn args '--no-parallel',
npm ERR! gyp info spawn args '--generator-output',
npm ERR! gyp info spawn args 'build',
npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! warning: /Library/Developer/CommandLineTools/usr/bin/libtool: archive library: Release/nothing.a the table of contents is empty (no object file members in the library define global symbols)
npm ERR! ../src/common.cc:24:10: fatal error: 'vips/vips8' file not found
npm ERR! #include <vips/vips8>
npm ERR! ^~~~~~~~~~~~
npm ERR! 1 error generated.
npm ERR! make: *** [Release/obj.target/sharp/src/common.o] Error 1
npm ERR! gyp ERR! build error
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.onExit (/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Darwin 22.2.0
npm ERR! gyp ERR! command "/opt/homebrew/Cellar/node/19.4.0/bin/node" "/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/seanshe/Desktop/bdab_website/node_modules/gatsby-transformer-sharp/node_modules/sharp
npm ERR! gyp ERR! node -v v19.4.0
npm ERR! gyp ERR! node-gyp -v v9.3.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/seanshe/.npm/_logs/2023-01-11T05_40_20_443Z-debug-0.log
1条答案
按热度按时间ttisahbt1#
该错误消息表明,预构建的libvips8.10.5二进制文件不适用于架构“darwin-arm 64 v8”,它正试图通过node-gyp从源代码构建。
要解决此问题,您可以按照sharp安装指南中提到的步骤操作:https://sharp.pixelplumbing.com/install并安装所需的依赖项。检查您的Node.js版本是否与最新版本的sharp包兼容也可能会有所帮助。