重新安装画布时出错



我在pacman-Syu更新后安装Canvas时遇到错误。我在pacman-Syu更新后卸载了Canvas,因为它在我的代码中引发了许多错误。我本来打算重新安装Canvas,但现在安装过程失败了。

我的节点版本是v19.0.0

错误:

$npm i画布

npm ERR! code 1
npm ERR! path /home/johann/Documents/dev/js/spotishare/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c -- node-pre-gyp install --fallback-to-build --update-binary
npm ERR! make: Entering directory '/home/johann/Documents/dev/js/spotishare/node_modules/canvas/build'
npm ERR!   SOLINK_MODULE(target) Release/obj.target/canvas-postbuild.node
npm ERR!   COPY 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! make: Leaving directory '/home/johann/Documents/dev/js/spotishare/node_modules/canvas/build'
npm ERR! Failed to execute '/usr/bin/node /usr/lib/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --update-binary --module=/home/johann/Documents/dev/js/spotishare/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/johann/Documents/dev/js/spotishare/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v111' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.10
npm ERR! node-pre-gyp info using node@19.0.0 | linux | x64
npm ERR! node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.10.1/canvas-v2.10.1-node-v111-linux-glibc-x64.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.10.1/canvas-v2.10.1-node-v111-linux-glibc-x64.tar.gz 
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for canvas@2.10.1 and node@19.0.0 (node-v111 ABI, glibc) (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/Automattic/node-canvas/releases/download/v2.10.1/canvas-v2.10.1-node-v111-linux-glibc-x64.tar.gz 
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.0.0 | linux | x64
npm ERR! gyp info ok 
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.0.0 | linux | x64
npm ERR! gyp info find Python using Python version 3.10.8 found at "/home/linuxbrew/.linuxbrew/opt/python@3.10/bin/python3.10"
npm ERR! gyp info spawn /home/linuxbrew/.linuxbrew/opt/python@3.10/bin/python3.10
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/lib/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   '/home/johann/Documents/dev/js/spotishare/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/lib/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/johann/.cache/node-gyp/19.0.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=/home/johann/.cache/node-gyp/19.0.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/johann/.cache/node-gyp/19.0.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/johann/Documents/dev/js/spotishare/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 node-gyp@9.3.0
npm ERR! gyp info using node@19.0.0 | linux | x64
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from /home/johann/.cache/node-gyp/19.0.0/include/node/v8-object.h:10,
npm ERR!                  from /home/johann/.cache/node-gyp/19.0.0/include/node/v8-array-buffer.h:13,
npm ERR!                  from /home/johann/.cache/node-gyp/19.0.0/include/node/v8.h:24,
npm ERR!                  from /home/johann/.cache/node-gyp/19.0.0/include/node/node.h:73,
npm ERR!                  from ../../nan/nan.h:60,
npm ERR!                  from ../src/backend/Backend.h:6,
npm ERR!                  from ../src/backend/Backend.cc:1:
npm ERR! In member function ‘bool v8::PersistentBase<T>::IsEmpty() const [with T = v8::Object]’,
npm ERR!     inlined from ‘void v8::PersistentBase<T>::Reset() [with T = v8::Object]’ at /home/johann/.cache/node-gyp/19.0.0/include/node/v8-persistent-handle.h:474:20,
npm ERR!     inlined from ‘void v8::PersistentBase<T>::Reset(v8::Isolate*, const v8::Local<S>&) [with S = v8::Object; T = v8::Object]’ at /home/johann/.cache/node-gyp/19.0.0/include/node/v8-persistent-handle.h:487:8,
npm ERR!     inlined from ‘void Nan::Persistent<T, M>::Reset(const v8::Local<S>&) [with S = v8::Object; T = v8::Object; M = v8::NonCopyablePersistentTraits<v8::Object>]’ at ../../nan/nan_persistent_12_inl.h:29:33,
npm ERR!     inlined from ‘void Nan::ObjectWrap::Wrap(v8::Local<v8::Object>)’ at ../../nan/nan_object_wrap.h:56:23,
npm ERR!     inlined from ‘static void Backend::init(const Nan::FunctionCallbackInfo<v8::Value>&)’ at ../src/backend/Backend.cc:23:16:
npm ERR! /home/johann/.cache/node-gyp/19.0.0/include/node/v8-persistent-handle.h:116:43: warning: array subscript 0 is outside array bounds of ‘Nan::Persistent<v8::Object> [0]’ [-Warray-bounds]
npm ERR!   116 |   V8_INLINE bool IsEmpty() const { return val_ == nullptr; }
npm ERR!       |                                           ^~~~
npm ERR! In member function ‘void v8::PersistentBase<T>::Reset() [with T = v8::Object]’,
npm ERR!     inlined from ‘void v8::PersistentBase<T>::Reset(v8::Isolate*, const v8::Local<S>&) [with S = v8::Object; T = v8::Object]’ at /home/johann/.cache/node-gyp/19.0.0/include/node/v8-persistent-handle.h:487:8,
npm ERR!     inlined from ‘void Nan::Persistent<T, M>::Reset(const v8::Local<S>&) [with S = v8::Object; T = v8::Object; M = v8::NonCopyablePersistentTraits<v8::Object>]’ at ../../nan/nan_persistent_12_inl.h:29:33,
npm ERR!     inlined from ‘void Nan::ObjectWrap::Wrap(v8::Local<v8::Object>)’ at ../../nan/nan_object_wrap.h:56:23,
npm ERR!     inlined from ‘static void Backend::init(const Nan::FunctionCallbackInfo<v8::Value>&)’ at ../src/backend/Backend.cc:23:16:
npm ERR! /home/johann/.cache/node-gyp/19.0.0/include/node/v8-persistent-handle.h:476:8: warning: array subscript 0 is outside array bounds of ‘Nan::Persistent<v8::Object> [0]’ [-Warray-bounds]
npm ERR!   476 |   val_ = nullptr;
npm ERR!       |   ~~~~~^~~~~~~~~
npm ERR! In member function ‘void v8::PersistentBase<T>::Reset(v8::Isolate*, const v8::Local<S>&) [with S = v8::Object; T = v8::Object]’,
npm ERR!     inlined from ‘void Nan::Persistent<T, M>::Reset(const v8::Local<S>&) [with S = v8::Object; T = v8::Object; M = v8::NonCopyablePersistentTraits<v8::Object>]’ at ../../nan/nan_persistent_12_inl.h:29:33,
npm ERR!     inlined from ‘void Nan::ObjectWrap::Wrap(v8::Local<v8::Object>)’ at ../../nan/nan_object_wrap.h:56:23,
npm ERR!     inlined from ‘static void Backend::init(const Nan::FunctionCallbackInfo<v8::Value>&)’ at ../src/backend/Backend.cc:23:16:
npm ERR! /home/johann/.cache/node-gyp/19.0.0/include/node/v8-persistent-handle.h:489:14: warning: array subscript 0 is outside array bounds of ‘Nan::Persistent<v8::Object> [0]’ [-Warray-bounds]
npm ERR!   489 |   this->val_ = New(isolate, other.val_);
npm ERR!       |   ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! In file included from ../src/Canvas.cc:21:
npm ERR! ../src/Util.h: In function ‘void SetProtoAccessor(v8::Local<v8::ObjectTemplate>, v8::Local<v8::String>, Nan::GetterCallback, Nan::SetterCallback, v8::Local<v8::FunctionTemplate>)’:
npm ERR! ../src/Util.h:26:21: error: ‘v8::AccessorSignature’ has not been declared
npm ERR!    26 |                 v8::AccessorSignature::New(v8::Isolate::GetCurrent(), ctor)
npm ERR!       |                     ^~~~~~~~~~~~~~~~~
npm ERR! make: *** [canvas.target.mk:180: 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 (/usr/lib/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 Linux 6.0.5-arch1-1
npm ERR! gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--update-binary" "--module=/home/johann/Documents/dev/js/spotishare/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/home/johann/Documents/dev/js/spotishare/node_modules/canvas/build/Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v111"
npm ERR! gyp ERR! cwd /home/johann/Documents/dev/js/spotishare/node_modules/canvas
npm ERR! gyp ERR! node -v v19.0.0
npm ERR! gyp ERR! node-gyp -v v9.3.0
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 '/usr/bin/node /usr/lib/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --update-binary --module=/home/johann/Documents/dev/js/spotishare/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/johann/Documents/dev/js/spotishare/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v111' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/johann/Documents/dev/js/spotishare/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1098:16)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:304:5)
npm ERR! node-pre-gyp ERR! System Linux 6.0.5-arch1-1
npm ERR! node-pre-gyp ERR! command "/usr/bin/node" "/home/johann/Documents/dev/js/spotishare/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
npm ERR! node-pre-gyp ERR! cwd /home/johann/Documents/dev/js/spotishare/node_modules/canvas
npm ERR! node-pre-gyp ERR! node -v v19.0.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.10
npm ERR! node-pre-gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR!     /home/johann/.npm/_logs/2022-10-28T11_57_31_089Z-debug-0.log

LLLLLLLLllLLLLLLLL

我不知道如何解决这个问题,但我现在已经将版本更改为带有$ n 18.12.0的v18.12.0,现在它可以使用

最新更新