重现
根目录:
npm install
或“npm install canvas”
npm 安装画布
错误
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: '[email protected]',
npm WARN EBADENGINE required: { node: '11.12.0', npm: '6.10.3' },
npm WARN EBADENGINE current: { node: 'v16.16.0', npm: '9.6.7' }
npm WARN EBADENGINE }
npm WARN deprecated [email protected]: npm is holding this package for security reasons. As it's a core Node module, we will not transfer it over to other users. You may safely remove the package from yo
ur dependencies. npm WARN deprecated [email protected]: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.
npm WARN deprecated [email protected]: this library is no longer supported
npm WARN deprecated [email protected]: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/ma
th-random for details. npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated [email protected]: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the fu
ture npm WARN deprecated [email protected]: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm ERR! code 1
npm ERR! path /Users/lennybeadle/rpsbet_mern/node_modules/color-thief/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build
npm ERR! SOLINK_MODULE(target) Release/canvas-postbuild.node
npm ERR! CXX(target) Release/obj.target/canvas/src/backend/Backend.o
npm ERR! CXX(target) Release/obj.target/canvas/src/backend/ImageBackend.o
npm ERR! CXX(target) Release/obj.target/canvas/src/backend/PdfBackend.o
npm ERR! CXX(target) Release/obj.target/canvas/src/backend/SvgBackend.o
npm ERR! CXX(target) Release/obj.target/canvas/src/bmp/BMPParser.o
npm ERR! CXX(target) Release/obj.target/canvas/src/Backends.o
npm ERR! CXX(target) Release/obj.target/canvas/src/Canvas.o
npm ERR! Failed to execute '/Users/lennybeadle/.nvm/versions/node/v16.16.0/bin/node /Users/lennybeadle/.nvm/versions/node/v16.16.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build -
-fallback-to-build --module=/Users/lennybeadle/rpsbet_mern/node_modules/color-thief/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/lennybeadle/rpsbet_mern/node_modules/color-thief/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1) npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using [email protected]
npm ERR! node-pre-gyp info using [email protected] | darwin | arm64
npm ERR! node-pre-gyp info check checked for "/Users/lennybeadle/rpsbet_mern/node_modules/color-thief/node_modules/canvas/build/Release/canvas.node" (not found)
npm ERR! node-pre-gyp http GET https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.5.0/canvas-v2.5.0-node-v93-darwin-unknown-arm64.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.5.0/canvas-v2.5.0-node-v93-darwin-unknown-arm64.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v93 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/node-gfx/node-canvas-prebuilt/releases/download/v2.5.0/canvas-v2.5.0-node-v93-darwin-unknown-arm64.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info find Python using Python version 3.11.6 found at "/opt/homebrew/opt/[email protected]/bin/python3.11"
npm ERR! gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.11
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/Users/lennybeadle/.nvm/versions/node/v16.16.0/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/lennybeadle/rpsbet_mern/node_modules/color-thief/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/lennybeadle/.nvm/versions/node/v16.16.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/lennybeadle/Library/Caches/node-gyp/16.16.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/lennybeadle/Library/Caches/node-gyp/16.16.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/lennybeadle/.nvm/versions/node/v16.16.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/lennybeadle/Library/Caches/node-gyp/16.16.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/lennybeadle/rpsbet_mern/node_modules/color-thief/node_modules/canvas',
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 ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! ../src/backend/Backend.cc:111:10: warning: address of stack memory associated with local variable 'msg' returned [-Wreturn-stack-address]
npm ERR! return msg.c_str();
npm ERR! ^~~
npm ERR! 1 warning generated.
npm ERR! ../src/backend/ImageBackend.cc:68:2: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
npm ERR! target->Set(v8ctx,
npm ERR! ^~~~~~~~~~~ ~~~~~~
npm ERR! 1 warning generated.
npm ERR! ../src/backend/PdfBackend.cc:47:3: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
npm ERR! target->Set(v8ctx,
npm ERR! ^~~~~~~~~~~ ~~~~~~
npm ERR! 1 warning generated.
npm ERR! ../src/backend/SvgBackend.cc:49:3: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
npm ERR! target->Set(v8ctx,
npm ERR! ^~~~~~~~~~~ ~~~~~~
npm ERR! 1 warning generated.
npm ERR! ../src/Backends.cc:18:3: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
npm ERR! target->Set(v8ctx, Nan::New<String>("Backends").ToLocalChecked(), obj);
npm ERR! ^~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! 1 warning generated.
npm ERR! In file included from ../src/Canvas.cc:21:
npm ERR! ../src/Util.h:17:7: warning: 'SetAccessor' is deprecated [-Wdeprecated-declarations]
npm ERR! Nan::SetAccessor(
npm ERR! ^
npm ERR! ../../../../nan/nan.h:2514:1: note: 'SetAccessor' has been explicitly marked deprecated here
npm ERR! NAN_DEPRECATED inline void SetAccessor(
npm ERR! ^
npm ERR! ../../../../nan/nan.h:112:40: note: expanded from macro 'NAN_DEPRECATED'
npm ERR! # define NAN_DEPRECATED __attribute__((deprecated))
npm ERR! ^
npm ERR! ../src/Canvas.cc:327:13: error: no matching member function for call to 'Get'
npm ERR! if (opts->Get(propName)->IsString()) {
npm ERR! ~~~~~~^~~
npm ERR! /Users/lennybeadle/Library/Caches/node-gyp/16.16.0/include/node/v8.h:4007:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
npm ERR! ^
npm ERR! /Users/lennybeadle/Library/Caches/node-gyp/16.16.0/include/node/v8.h:4010:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
npm ERR! ^
npm ERR! ../src/Canvas.cc:328:22: error: no matching member function for call to 'Get'
npm ERR! auto val = opts->Get(propName);
npm ERR! ~~~~~~^~~
npm ERR! /Users/lennybeadle/Library/Caches/node-gyp/16.16.0/include/node/v8.h:4007:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
npm ERR! ^
npm ERR! /Users/lennybeadle/Library/Caches/node-gyp/16.16.0/include/node/v8.h:4010:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
npm ERR! ^
npm ERR! ../src/Canvas.cc:337:13: error: no matching member function for call to 'Get'
npm ERR! if (opts->Get(propName)->IsDate()) {
npm ERR! ~~~~~~^~~
npm ERR! /Users/lennybeadle/Library/Caches/node-gyp/16.16.0/include/node/v8.h:4007:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
npm ERR! ^
npm ERR! /Users/lennybeadle/Library/Caches/node-gyp/16.16.0/include/node/v8.h:4010:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
npm ERR! ^
npm ERR! ../src/Canvas.cc:338:22: error: no matching member function for call to 'Get'
npm ERR! auto val = opts->Get(propName).As<Date>();
npm ERR! ~~~~~~^~~
npm ERR! /Users/lennybeadle/Library/Caches/node-gyp/16.16.0/include/node/v8.h:4007:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
npm ERR! ^
npm ERR! /Users/lennybeadle/Library/Caches/node-gyp/16.16.0/include/node/v8.h:4010:43: note: candidate function not viable: requires 2 arguments, but 1 was provided
npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
npm ERR! ^
npm ERR! 1 warning and 4 errors generated.
npm ERR! make: *** [Release/obj.target/canvas/src/Canvas.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 (/Users/lennybeadle/.nvm/versions/node/v16.16.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:203:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:527:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Darwin 23.1.0
npm ERR! gyp ERR! command "/Users/lennybeadle/.nvm/versions/node/v16.16.0/bin/node" "/Users/lennybeadle/.nvm/versions/node/v16.16.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "buil
d" "--fallback-to-build" "--module=/Users/lennybeadle/rpsbet_mern/node_modules/color-thief/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/Users/lennybeadle/rpsbet_mern/node_modules/color-thief/node_modules/canvas/build/Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v93" npm ERR! gyp ERR! cwd /Users/lennybeadle/rpsbet_mern/node_modules/color-thief/node_modules/canvas
npm ERR! gyp ERR! node -v v16.16.0
npm ERR! gyp ERR! node-gyp -v v9.3.1
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute '/Users/lennybeadle/.nvm/versions/node/v16.16.0/bin/node /Users/lennybeadle/.nvm/versions/node/v16.16.0/lib/node_modules/npm/node_modules/n
ode-gyp/bin/node-gyp.js build --fallback-to-build --module=/Users/lennybeadle/rpsbet_mern/node_modules/color-thief/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/lennybeadle/rpsbet_mern/node_modules/color-thief/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1) npm ERR! node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/lennybeadle/rpsbet_mern/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.emit (node:events:527:28)
npm ERR! node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1092:16)
npm ERR! node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm ERR! node-pre-gyp ERR! System Darwin 23.1.0
npm ERR! node-pre-gyp ERR! command "/Users/lennybeadle/.nvm/versions/node/v16.16.0/bin/node" "/Users/lennybeadle/rpsbet_mern/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /Users/lennybeadle/rpsbet_mern/node_modules/color-thief/node_modules/canvas
npm ERR! node-pre-gyp ERR! node -v v16.16.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.11
npm ERR! node-pre-gyp ERR! not ok
npm ERR! A complete log of this run can be found in: /Users/lennybeadle/.npm/_logs/2023-12-09T22_29_49_469Z-debug-0.log
我尝试过的
NVM 使用 12、16、20、21(不起作用) 新下午 6, 9, 10
Python 2.7(降级)和3.6
sudo npm install --force
/ --legacy-peer-deps
手动重新安装 Xcode
sudo xcode-select --switch /Library/Developer/CommandLineTools
sudo xcode-select --reset
以及此处提到的其他解决方案 `npm install` 在使用 `gyp:未检测到 Xcode 或 CLT 版本!`时,node-gyp 重建失败!`
无法使用Git后安装缺少的工具来转换源代码:
brew install pkg-config cairo pango libpng jpeg giflib librsvg
我猜是Python,因为前面提到的node-gyp、color-thief和canvas都使用了它。
我从另一个论坛解决了这个问题,但我丢失了链接。
解决方案: Color-thief 使用的是过时版本的画布,尽管它可以在我的另一台电脑上运行,但提交完全相同。我刚刚删除了 color-thief,因为已经花了好几天了啊哈哈。