无法找到 Node 包安装失败的确切原因

Unable to find the exact reason of a Node package failing to install

我正在尝试在 Ubuntu 22.04 LTS(使用 WSL2)上的 Node v16.15.0 中安装名为 sawtooth-SDK 的 NPM 包。

最初,我试图在 React 应用程序中安装。然后我想也许这个包与纯 Node.js 有关。然后我就启动了一个简单的npm项目,尝试安装示例包,还是报同样的错误。

    DESKTOP-7JEH9MN:~/a$ npm i sawtooth-sdk
npm WARN deprecated uuid@3.4.0: 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/math-random for details.
npm ERR! code 1
npm ERR! path /home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq
npm ERR! command failed
npm ERR! command sh -c node scripts/prebuild-install.js || (node scripts/preinstall.js && node-gyp rebuild)
npm ERR! Building libzmq for linux
npm ERR! checking for a BSD-compatible install... /usr/bin/install -c
npm ERR! checking whether build environment is sane... yes
npm ERR! checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
npm ERR! checking for gawk... gawk
npm ERR! checking whether C++ compiler supports -fvisibility=hidden... yes
npm ERR! checking whether C++ compiler supports dso visibility... yes
npm ERR! checking whether to build documentation... no
npm ERR! checking whether to install manpages... no
npm ERR! configure: Choosing polling system from 'kqueue epoll devpoll pollset poll select'...
npm ERR! configure: Using 'epoll' polling system with CLOEXEC
npm ERR! checking for ANSI C header files... (cached) yes
npm ERR! configure: Using tweetnacl for CURVE security
npm ERR! checking for ./.git... no
npm ERR! configure: Building stable and legacy API (no draft API)
npm ERR! checking for LIBUNWIND... no
npm ERR! checking that generated files are newer than configure... done
npm ERR! configure: creating ./config.status
npm ERR! config.status: creating Makefile
npm ERR! config.status: creating src/libzmq.pc
npm ERR! config.status: creating doc/Makefile
npm ERR! config.status: creating builds/Makefile
npm ERR! config.status: creating builds/msvc/Makefile
npm ERR! config.status: creating src/platform.hpp
npm ERR! config.status: executing depfiles commands
npm ERR! config.status: executing libtool commands
npm ERR! Making all in doc
npm ERR! make[1]: Entering directory '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/zmq/zeromq-4.2.2/doc'
npm ERR! make[1]: Nothing to be done for 'all'.
npm ERR! make[1]: Leaving directory '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/zmq/zeromq-4.2.2/doc'
npm ERR! make[1]: Entering directory '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/zmq/zeromq-4.2.2'
npm ERR!   CXX      src/src_libzmq_la-client.lo
npm ERR!   CXX      src/src_libzmq_la-address.lo
npm ERR!   CXX      src/src_libzmq_la-clock.lo
npm ERR!   CXX      src/src_libzmq_la-ctx.lo
npm ERR!   CXX      src/src_libzmq_la-curve_client.lo
npm ERR!   CXX      src/src_libzmq_la-curve_server.lo
npm ERR!   CXX      src/src_libzmq_la-dealer.lo
npm ERR!   CXX      src/src_libzmq_la-devpoll.lo
npm ERR!   CXX      src/src_libzmq_la-dgram.lo
npm ERR!   CXX      src/src_libzmq_la-dish.lo
npm ERR!   CXX      src/src_libzmq_la-dist.lo
npm ERR!   CXX      src/src_libzmq_la-epoll.lo
npm ERR!   CXX      src/src_libzmq_la-err.lo
npm ERR!   CXX      src/src_libzmq_la-fq.lo
npm ERR!   CXX      src/src_libzmq_la-gather.lo
npm ERR!   CXX      src/src_libzmq_la-gssapi_mechanism_base.lo
npm ERR!   CXX      src/src_libzmq_la-gssapi_client.lo
npm ERR!   CXX      src/src_libzmq_la-gssapi_server.lo
npm ERR!   CXX      src/src_libzmq_la-io_object.lo
npm ERR!   CXX      src/src_libzmq_la-io_thread.lo
npm ERR!   CXX      src/src_libzmq_la-ip.lo
npm ERR!   CXX      src/src_libzmq_la-ipc_address.lo
npm ERR!   CXX      src/src_libzmq_la-ipc_connecter.lo
npm ERR!   CXX      src/src_libzmq_la-ipc_listener.lo
npm ERR!   CXX      src/src_libzmq_la-kqueue.lo
npm ERR!   CXX      src/src_libzmq_la-lb.lo
npm ERR!   CXX      src/src_libzmq_la-mailbox.lo
npm ERR!   CXX      src/src_libzmq_la-mailbox_safe.lo
npm ERR!   CXX      src/src_libzmq_la-mechanism.lo
npm ERR!   CXX      src/src_libzmq_la-metadata.lo
npm ERR!   CXX      src/src_libzmq_la-msg.lo
npm ERR!   CXX      src/src_libzmq_la-mtrie.lo
npm ERR!   CXX      src/src_libzmq_la-norm_engine.lo
npm ERR!   CXX      src/src_libzmq_la-null_mechanism.lo
npm ERR!   CXX      src/src_libzmq_la-object.lo
npm ERR!   CXX      src/src_libzmq_la-options.lo
npm ERR!   CXX      src/src_libzmq_la-own.lo
npm ERR!   CXX      src/src_libzmq_la-pair.lo
npm ERR!   CXX      src/src_libzmq_la-pgm_receiver.lo
npm ERR!   CXX      src/src_libzmq_la-pgm_sender.lo
npm ERR!   CXX      src/src_libzmq_la-pgm_socket.lo
npm ERR!   CXX      src/src_libzmq_la-pipe.lo
npm ERR!   CXX      src/src_libzmq_la-plain_client.lo
npm ERR!   CXX      src/src_libzmq_la-plain_server.lo
npm ERR!   CXX      src/src_libzmq_la-poll.lo
npm ERR!   CXX      src/src_libzmq_la-poller_base.lo
npm ERR!   CXX      src/src_libzmq_la-pollset.lo
npm ERR!   CXX      src/src_libzmq_la-precompiled.lo
npm ERR!   CXX      tools/curve_keygen.o
npm ERR!   CXX      perf/local_lat.o
npm ERR!   CXX      perf/remote_lat.o
npm ERR!   CXX      perf/local_thr.o
npm ERR!   CXX      perf/remote_thr.o
npm ERR!   CXX      perf/inproc_lat.o
npm ERR!   CXX      perf/inproc_thr.o
npm ERR!   CXXLD    src/libzmq.la
npm ERR!   CXXLD    tools/curve_keygen
npm ERR!   CXXLD    perf/local_lat
npm ERR!   CXXLD    perf/remote_lat
npm ERR!   CXXLD    perf/local_thr
npm ERR!   CXXLD    perf/remote_thr
npm ERR!   CXXLD    perf/inproc_lat
npm ERR!   CXXLD    perf/inproc_thr
npm ERR! make[1]: Leaving directory '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/zmq/zeromq-4.2.2'
npm ERR! Making install in doc
npm ERR! make[1]: Entering directory '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/zmq/zeromq-4.2.2/doc'
npm ERR! make[2]: Entering directory '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/zmq/zeromq-4.2.2/doc'
npm ERR! make[2]: Nothing to be done for 'install-exec-am'.
npm ERR! make[2]: Leaving directory '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/zmq/zeromq-4.2.2/doc'
npm ERR! make[1]: Leaving directory '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/zmq/zeromq-4.2.2/doc'
npm ERR! make[1]: Entering directory '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/zmq/zeromq-4.2.2'
npm ERR! make[2]: Entering directory '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/zmq/zeromq-4.2.2'
npm ERR!  /usr/bin/mkdir -p '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/scripts/../zmq/lib'
npm ERR!  /bin/bash ./libtool   --mode=install /usr/bin/install -c   src/libzmq.la '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/scripts/../zmq/lib'
npm ERR! libtool: install: /usr/bin/install -c src/.libs/libzmq.lai /home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/scripts/../zmq/lib/libzmq.la
npm ERR! libtool: install: /usr/bin/install -c src/.libs/libzmq.a /home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/scripts/../zmq/lib/libzmq.a
npm ERR! libtool: install: chmod 644 /home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/scripts/../zmq/lib/libzmq.a
npm ERR! libtool: install: ranlib /home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/scripts/../zmq/lib/libzmq.a
npm ERR! libtool: finish: PATH="/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/node_modules/.bin:/home/nayan/sawtooth-tuna/sdk-test/node_modules/node_modules/.bin:/home/nayan/sawtooth-tuna/sdk-test/node_modules/.bin:/home/nayan/sawtooth-tuna/node_modules/.bin:/home/nayan/node_modules/.bin:/home/node_modules/.bin:/node_modules/.bin:/usr/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/node-gyp-bin:/home/nayan/.vscode-server/bin/da15b6fd3ef856477bf6f4fb29ba1b7af717770d/bin/remote-cli:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files (x86)/Razer Chroma SDK/bin:/mnt/c/Program Files/Razer Chroma SDK/bin:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.6/bin:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.6/libnvvp:/mnt/c/Program Files (x86)/Razer/ChromaBroadcast/bin:/mnt/c/Program Files/Razer/ChromaBroadcast/bin:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/Microsoft SQL Server/150/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/Client SDK/ODBC/170/Tools/Binn/:/mnt/c/Program Files/dotnet/:/mnt/c/Program Files (x86)/Microsoft SQL Server/150/DTS/Binn/:/mnt/c/Program Files (x86)/Microsoft SQL Server/150/Tools/Binn/:/mnt/c/Program Files/Microsoft SQL Server/150/DTS/Binn/:/mnt/c/Program Files/Git/cmd:/mnt/c/Program Files (x86)/NVIDIA Corporation/PhysX/Common:/mnt/c/Program Files/NVIDIA Corporation/NVIDIA NvDLISR:/mnt/c/WINDOWS/system32/config/systemprofile/AppData/Local/Microsoft/WindowsApps:/mnt/c/Program Files (x86)/Windows Kits/10/Windows Performance Toolkit/:/mnt/c/Program Files/NVIDIA Corporation/Nsight Compute 2022.1.1/:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.6/extras/CUPTI/lib64:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.6/include:/mnt/c/tools/cudnn-windows-x86_64-8.4.0.27_cuda11.6-archive/bin:/mnt/c/tools/cudnn-windows-x86_64-8.4.0.27_cuda11.6-archive/include:/mnt/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.6/extras/CUPTI/include:/mnt/c/Program Files/Docker/Docker/resources/bin:/mnt/c/ProgramData/DockerDesktop/version-bin:/mnt/c/Program Files/nodejs/:/mnt/c/Users/nayan/anaconda3:/mnt/c/Users/nayan/anaconda3/Library/mingw-w64/bin:/mnt/c/Users/nayan/anaconda3/Library/usr/bin:/mnt/c/Users/nayan/anaconda3/Library/bin:/mnt/c/Users/nayan/anaconda3/Scripts:/mnt/c/Users/nayan/AppData/Local/Microsoft/WindowsApps:/mnt/c/Users/nayan/AppData/Local/Programs/Microsoft VS Code/bin:/mnt/c/Users/nayan/.dotnet/tools:/mnt/c/Program Files/Azure Data Studio/bin:/mnt/c/Program Files/JetBrains/PyCharm 2021.3.3/bin:/mnt/c/Program Files/JetBrains/WebStorm 2021.3.3/bin:/mnt/c/Program Files/JetBrains/CLion 2021.3.4/bin:/mnt/c/Program Files/JetBrains/JetBrains Rider 2021.3.4/bin:/mnt/c/Program Files/JetBrains/IntelliJ IDEA 2021.3.3/bin:/mnt/c/Users/nayan/AppData/Roaming/npm:/snap/bin:/sbin" ldconfig -n /home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/scripts/../zmq/lib
npm ERR! ----------------------------------------------------------------------
npm ERR! Libraries have been installed in:
npm ERR!    /home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/scripts/../zmq/lib
npm ERR! 
npm ERR! If you ever happen to want to link against installed libraries
npm ERR! in a given directory, LIBDIR, you must either use libtool, and
npm ERR! specify the full pathname of the library, or use the `-LLIBDIR'
npm ERR! flag during linking and do at least one of the following:
npm ERR!    - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
npm ERR!      during execution
npm ERR!    - add LIBDIR to the `LD_RUN_PATH' environment variable
npm ERR!      during linking
npm ERR!    - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
npm ERR!    - have your system administrator add LIBDIR to `/etc/ld.so.conf'
npm ERR! 
npm ERR! See any operating system documentation about shared libraries for
npm ERR! more information, such as the ld(1) and ld.so(8) manual pages.
npm ERR! ----------------------------------------------------------------------
npm ERR!  /usr/bin/mkdir -p '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/scripts/../zmq/bin'
npm ERR!   /bin/bash ./libtool   --mode=install /usr/bin/install -c tools/curve_keygen '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/scripts/../zmq/bin'
npm ERR! libtool: install: /usr/bin/install -c tools/curve_keygen /home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/scripts/../zmq/bin/curve_keygen
npm ERR!  /usr/bin/mkdir -p '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/scripts/../zmq/include'
npm ERR!  /usr/bin/install -c -m 644 include/zmq.h include/zmq_utils.h '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/scripts/../zmq/include'
npm ERR!  /usr/bin/mkdir -p '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/scripts/../zmq/lib/pkgconfig'
npm ERR!  /usr/bin/install -c -m 644 src/libzmq.pc '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/scripts/../zmq/lib/pkgconfig'
npm ERR! make[2]: Leaving directory '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/zmq/zeromq-4.2.2'
npm ERR! make[1]: Leaving directory '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/zmq/zeromq-4.2.2'
npm ERR! Succesfully build libzmq on Mon May 16 2022 20:24:50 GMT+0200 (Central European Summer Time)
npm ERR! make: Entering directory '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/build'
npm ERR!   CXX(target) Release/obj.target/zmq/binding.o
npm ERR! make: Leaving directory '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/build'
npm ERR! configure: WARNING: Cannot find libunwind
npm ERR! ar: `u' modifier ignored since `D' is the default (see `U')
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@9.0.0
npm ERR! gyp info using node@16.15.0 | linux | x64
npm ERR! gyp info find Python using Python version 3.10.4 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/usr/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   '/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/nayan/.cache/node-gyp/16.15.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/nayan/.cache/node-gyp/16.15.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/nayan/.cache/node-gyp/16.15.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq',
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! ../binding.cc: In member function ‘void zmq::Socket::NotifyReadReady()’:
npm ERR! ../binding.cc:394:22: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
npm ERR!   394 |     Nan::MakeCallback(this->handle(), callback_v.As<Function>(), 0, NULL);
npm ERR!       |     ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! In file included from ../binding.cc:40:
npm ERR! ../../nan/nan.h:1028:46: note: declared here
npm ERR!  1028 |   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
npm ERR!       |                                              ^~~~~~~~~~~~
npm ERR! ../binding.cc: In member function ‘void zmq::Socket::NotifySendReady()’:
npm ERR! ../binding.cc:402:22: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
npm ERR!   402 |     Nan::MakeCallback(this->handle(), callback_v.As<Function>(), 0, NULL);
npm ERR!       |     ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! In file included from ../binding.cc:40:
npm ERR! ../../nan/nan.h:1028:46: note: declared here
npm ERR!  1028 |   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
npm ERR!       |                                              ^~~~~~~~~~~~
npm ERR! ../binding.cc: In member function ‘void zmq::Socket::MonitorEvent(uint16_t, int32_t, char*)’:
npm ERR! ../binding.cc:453:22: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
npm ERR!   453 |     Nan::MakeCallback(this->handle(), callback_v.As<Function>(), 4, argv);
npm ERR!       |     ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! In file included from ../binding.cc:40:
npm ERR! ../../nan/nan.h:1028:46: note: declared here
npm ERR!  1028 |   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
npm ERR!       |                                              ^~~~~~~~~~~~
npm ERR! ../binding.cc: In member function ‘void zmq::Socket::MonitorError(const char*)’:
npm ERR! ../binding.cc:468:22: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
npm ERR!   468 |     Nan::MakeCallback(this->handle(), callback_v.As<Function>(), 1, argv);
npm ERR!       |     ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! In file included from ../binding.cc:40:
npm ERR! ../../nan/nan.h:1028:46: note: declared here
npm ERR!  1028 |   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
npm ERR!       |                                              ^~~~~~~~~~~~
npm ERR! ../binding.cc: In static member function ‘static void zmq::Socket::UV_MonitorCallback(uv_timer_t*, int)’:
npm ERR! ../binding.cc:540:42: warning: cast between incompatible function types from ‘void (*)(uv_timer_t*, int)’ {aka ‘void (*)(uv_timer_s*, int)’} to ‘uv_timer_cb’ {aka ‘void (*)(uv_timer_s*)’} [-Wcast-function-type]
npm ERR!   540 |       uv_timer_start(s->monitor_handle_, reinterpret_cast<uv_timer_cb>(Socket::UV_MonitorCallback), s->timer_interval_, 0);
npm ERR!       |                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! ../binding.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE zmq::Socket::Bind(Nan::NAN_METHOD_ARGS_TYPE)’:
npm ERR! ../binding.cc:774:19: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
npm ERR!   774 |                   (uv_after_work_cb)UV_BindAsyncAfter);
npm ERR!       |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! ../binding.cc: In static member function ‘static void zmq::Socket::UV_BindAsyncAfter(uv_work_t*)’:
npm ERR! ../binding.cc:809:22: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
npm ERR!   809 |     Nan::MakeCallback(Nan::GetCurrentContext()->Global(), cb, 1, argv);
npm ERR!       |     ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! In file included from ../binding.cc:40:
npm ERR! ../../nan/nan.h:1028:46: note: declared here
npm ERR!  1028 |   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
npm ERR!       |                                              ^~~~~~~~~~~~
npm ERR! ../binding.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE zmq::Socket::Unbind(Nan::NAN_METHOD_ARGS_TYPE)’:
npm ERR! ../binding.cc:855:19: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
npm ERR!   855 |                   (uv_after_work_cb)UV_UnbindAsyncAfter);
npm ERR!       |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! ../binding.cc: In static member function ‘static void zmq::Socket::UV_UnbindAsyncAfter(uv_work_t*)’:
npm ERR! ../binding.cc:888:22: warning: ‘v8::Local<v8::Value> Nan::MakeCallback(v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*)’ is deprecated [-Wdeprecated-declarations]
npm ERR!   888 |     Nan::MakeCallback(Nan::GetCurrentContext()->Global(), cb, 1, argv);
npm ERR!       |     ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! In file included from ../binding.cc:40:
npm ERR! ../../nan/nan.h:1028:46: note: declared here
npm ERR!  1028 |   NAN_DEPRECATED inline v8::Local<v8::Value> MakeCallback(
npm ERR!       |                                              ^~~~~~~~~~~~
npm ERR! ../binding.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE zmq::Socket::Monitor(Nan::NAN_METHOD_ARGS_TYPE)’:
npm ERR! ../binding.cc:1057:47: warning: cast between incompatible function types from ‘void (*)(uv_timer_t*, int)’ {aka ‘void (*)(uv_timer_s*, int)’} to ‘uv_timer_cb’ {aka ‘void (*)(uv_timer_s*)’} [-Wcast-function-type]
npm ERR!  1057 |       uv_timer_start(socket->monitor_handle_, reinterpret_cast<uv_timer_cb>(Socket::UV_MonitorCallback), timer_interval, 0);
npm ERR!       |                                               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! ../binding.cc: In constructor ‘zmq::Socket::OutgoingMessage::BufferReference::BufferReference(v8::Local<v8::Object>)’:
npm ERR! ../binding.cc:1227:41: warning: cast between incompatible function types from ‘void (*)(uv_async_t*, int)’ {aka ‘void (*)(uv_async_s*, int)’} to ‘uv_async_cb’ {aka ‘void (*)(uv_async_s*)’} [-Wcast-function-type]
npm ERR!  1227 |             uv_async_init(loop, &async, reinterpret_cast<uv_async_cb>(cleanup));
npm ERR!       |                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! ../binding.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE zmq::Socket::Sendv(Nan::NAN_METHOD_ARGS_TYPE)’:
npm ERR! ../binding.cc:1295:37: error: no matching function for call to ‘v8::Array::Get(uint32_t&)’
npm ERR!  1295 |       Local<Object> buf = batch->Get(i).As<Object>();
npm ERR!       |                           ~~~~~~~~~~^~~
npm ERR! In file included from ../binding.cc:24:
npm ERR! /home/nayan/.cache/node-gyp/16.15.0/include/node/v8.h:4007:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)’
npm ERR!  4007 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
npm ERR!       |                                           ^~~
npm ERR! /home/nayan/.cache/node-gyp/16.15.0/include/node/v8.h:4007:43: note:   candidate expects 2 arguments, 1 provided
npm ERR! /home/nayan/.cache/node-gyp/16.15.0/include/node/v8.h:4010:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)’
npm ERR!  4010 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
npm ERR!       |                                           ^~~
npm ERR! /home/nayan/.cache/node-gyp/16.15.0/include/node/v8.h:4010:43: note:   candidate expects 2 arguments, 1 provided
npm ERR! ../binding.cc:1295:50: error: expected primary-expression before ‘>’ token
npm ERR!  1295 |       Local<Object> buf = batch->Get(i).As<Object>();
npm ERR!       |                                                  ^
npm ERR! ../binding.cc:1295:52: error: expected primary-expression before ‘)’ token
npm ERR!  1295 |       Local<Object> buf = batch->Get(i).As<Object>();
npm ERR!       |                                                    ^
npm ERR! ../binding.cc:1296:42: error: no matching function for call to ‘v8::Array::Get(uint32_t)’
npm ERR!  1296 |       Local<Number> flagsObj = batch->Get(i + 1).As<Number>();
npm ERR!       |                                ~~~~~~~~~~^~~~~~~
npm ERR! In file included from ../binding.cc:24:
npm ERR! /home/nayan/.cache/node-gyp/16.15.0/include/node/v8.h:4007:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)’
npm ERR!  4007 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
npm ERR!       |                                           ^~~
npm ERR! /home/nayan/.cache/node-gyp/16.15.0/include/node/v8.h:4007:43: note:   candidate expects 2 arguments, 1 provided
npm ERR! /home/nayan/.cache/node-gyp/16.15.0/include/node/v8.h:4010:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)’
npm ERR!  4010 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,
npm ERR!       |                                           ^~~
npm ERR! /home/nayan/.cache/node-gyp/16.15.0/include/node/v8.h:4010:43: note:   candidate expects 2 arguments, 1 provided
npm ERR! ../binding.cc:1296:59: error: expected primary-expression before ‘>’ token
npm ERR!  1296 |       Local<Number> flagsObj = batch->Get(i + 1).As<Number>();
npm ERR!       |                                                           ^
npm ERR! ../binding.cc:1296:61: error: expected primary-expression before ‘)’ token
npm ERR!  1296 |       Local<Number> flagsObj = batch->Get(i + 1).As<Number>();
npm ERR!       |                                                             ^
npm ERR! In file included from ../binding.cc:25:
npm ERR! ../binding.cc: At global scope:
npm ERR! /home/nayan/.cache/node-gyp/16.15.0/include/node/node.h:847:7: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
npm ERR!   847 |       (node::addon_register_func) (regfunc),                          \
npm ERR!       |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! /home/nayan/.cache/node-gyp/16.15.0/include/node/node.h:881:3: note: in expansion of macro ‘NODE_MODULE_X’
npm ERR!   881 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
npm ERR!       |   ^~~~~~~~~~~~~
npm ERR! ../binding.cc:1610:1: note: in expansion of macro ‘NODE_MODULE’
npm ERR!  1610 | NODE_MODULE(zmq, init)
npm ERR!       | ^~~~~~~~~~~
npm ERR! make: *** [zmq.target.mk:113: Release/obj.target/zmq/binding.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/npm/node_modules/node-gyp/lib/build.js:194: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 Linux 5.10.16.3-microsoft-standard-WSL2
npm ERR! gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/nayan/sawtooth-tuna/sdk-test/node_modules/zeromq
npm ERR! gyp ERR! node -v v16.15.0
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /a/.npm/_logs/2022-05-16T18_24_17_806Z-debug-0.log

为什么会报错?我找不到任何具体的错误消息。

你的错误是:

npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher.

第 2 行

因此,我认为您首先需要升级您的版本!

我找到了解决方案。目前,Sawtooth SDK 仅适用于 Node 版本 <= 12.*