Can anyone help fixing my error on installing isolated-vm? - node.js

I run into the following error installing the npm package isolated VM on Debian 11:
https://www.npmjs.com/package/isolated-vm
The log doesn't help me that much...
npm ERR! code 1
npm ERR! path /home/screeps/screeps-server/node_modules/isolated-vm
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild --release -j 4
npm ERR! make: Entering directory '/home/screeps/screeps-server/node_modules/isolated-vm/build'
npm ERR! CXX(target) Release/obj.target/nortti/src/external_copy/serializer_nortti.o
npm ERR! CXX(target) Release/obj.target/nortti/src/isolate/allocator_nortti.o
npm ERR! AR(target) Release/obj.target/nortti.a
npm ERR! COPY Release/nortti.a
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/external_copy/external_copy.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/external_copy/serializer.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/external_copy/string.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/isolate/environment.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/isolate/executor.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/isolate/holder.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/isolate/inspector.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/isolate/platform_delegate.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/isolate/scheduler.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/isolate/stack_trace.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/isolate/three_phase_task.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/lib/thread_pool.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/lib/timer.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/module/callback.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/module/context_handle.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/module/evaluation.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/module/external_copy_handle.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/module/isolate.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/module/isolate_handle.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/module/lib_handle.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/module/module_handle.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/module/native_module_handle.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/module/reference_handle.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/module/script_handle.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/module/session_handle.o
npm ERR! CXX(target) Release/obj.target/isolated_vm/src/module/transferable.o
npm ERR! SOLINK_MODULE(target) Release/obj.target/isolated_vm.node
npm ERR! make: Leaving directory '/home/screeps/screeps-server/node_modules/isolated-vm/build'
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#12.22.5 | linux | x64
npm ERR! gyp info find Python using Python version 3.9.2 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/local/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/screeps/screeps-server/node_modules/isolated-vm/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/screeps/.cache/node-gyp/12.22.5/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/screeps/.cache/node-gyp/12.22.5',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/home/screeps/.cache/node-gyp/12.22.5/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/screeps/screeps-server/node_modules/isolated-vm',
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', '--jobs', 4 ]
npm ERR! ../src/isolate/environment.cc:25: warning: "_GNU_SOURCE" redefined
npm ERR! 25 | #define _GNU_SOURCE
npm ERR! |
npm ERR! <command-line>: note: this is the location of the previous definition
npm ERR! ../src/module/lib_handle.cc: In member function 'v8::Local<v8::Value> ivm::LibHandle::PrivateSymbol(v8::MaybeLocal<v8::String>)':
npm ERR! ../src/module/lib_handle.cc:58:10: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
npm ERR! 58 | return *reinterpret_cast<Local<Value>*>(&symbol);
npm ERR! | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm ERR! ../src/module/lib_handle.cc:58:10: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing]
npm ERR! /usr/bin/ld: cannot find -lbrotlidec
npm ERR! /usr/bin/ld: cannot find -lbrotlienc
npm ERR! /usr/bin/ld: cannot find -lcares
npm ERR! /usr/bin/ld: cannot find -lnghttp2
npm ERR! /usr/bin/ld: cannot find -licui18n
npm ERR! /usr/bin/ld: cannot find -licuuc
npm ERR! /usr/bin/ld: cannot find -licudata
npm ERR! collect2: error: ld returned 1 exit status
npm ERR! make: *** [isolated_vm.target.mk:229: Release/obj.target/isolated_vm.node] 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/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:314:20)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
npm ERR! gyp ERR! System Linux 4.19.0
npm ERR! gyp ERR! command "/usr/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release" "-j" "4"
npm ERR! gyp ERR! cwd /home/screeps/screeps-server/node_modules/isolated-vm
npm ERR! gyp ERR! node -v v12.22.5
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! /home/screeps/.npm/_logs/2022-05-03T11_59_47_268Z-debug-0.log
I can't open the log afterwards because the folder gets already deleted.
Something has to be up with the libs:
lbrotlidec, lbrotlienc
Any ideas, how to fix this?

Check if the version of NodeJS that you are currently using is compatible with the version of isolated-vm that you are trying to install.
https://www.npmjs.com/package/isolated-vm#requirements
For example, I was trying to install another library and I was getting a similar error, my version of node was 16, downgraded it to 12 and no more errors.

Related

robotjs npm install ERROR: gyp ERR! (Ubuntu 20.04)

I have node.js installed and I have tried various commands and installations but I keep getting a weird error when trying to do
npm install robotjs
So this is the error
root#name-VirtualBox:/home/name/Desktop# npm install robotjs
npm ERR! code 1
npm ERR! path /home/name/node_modules/robotjs
npm ERR! command failed
npm ERR! command sh -c prebuild-install || node-gyp rebuild
npm ERR! make: Entering directory '/home/name/node_modules/robotjs/build'
npm ERR! CXX(target) Release/obj.target/robotjs/src/robotjs.o
npm ERR! make: Leaving directory '/home/name/node_modules/robotjs/build'
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#8.4.1
npm ERR! gyp info using node#12.22.9 | linux | x64
npm ERR! gyp info find Python using Python version 3.10.6 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/share/nodejs/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/name/node_modules/robotjs/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/share/nodejs/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/include/nodejs/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=/usr/include/nodejs',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/usr/share/nodejs/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/usr/include/nodejs/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/name/node_modules/robotjs',
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! cc1plus: warning: command-line option ‘-Wbad-function-cast’ is valid for C/ObjC but not for C++
npm ERR! In file included from ../src/keypress.h:6,
npm ERR! from ../src/robotjs.cc:7:
npm ERR! ../src/keycode.h:112:10: fatal error: X11/Xutil.h: No such file or directory
npm ERR! 112 | #include <X11/Xutil.h>
npm ERR! | ^~~~~~~~~~~~~
npm ERR! compilation terminated.
npm ERR! make: *** [robotjs.target.mk:133: Release/obj.target/robotjs/src/robotjs.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/share/nodejs/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:314:20)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
npm ERR! gyp ERR! System Linux 5.15.0-58-generic
npm ERR! gyp ERR! command "/usr/bin/node" "/usr/share/nodejs/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/name/node_modules/robotjs
npm ERR! gyp ERR! node -v v12.22.9
npm ERR! gyp ERR! node-gyp -v v8.4.1
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2023-02-06T22_27_59_161Z-debug-0.log
Any hint would be greatly appreciated!
NPM tells you that a header is missing to be able to compile the library with your version of node.
Just install the missing libraries for the installation of robotjs to pass.
Under Ubuntu:
sudo apt install libx11-dev libxtst-dev
Then the installation of robotjs works (tested on Ubuntu 22.04).
you need to install an older version of node.js to be able to run robotjs. An older version of node.js you can try is v12.16.1, and you may be able to run robotjs

Why am I getting an error involving node-gyp when installing zeromq on my CentOS 7.9 VM?

I have a NextJS application on my Windows machine and have been able to use the zeromq package without any issue. But when I attempt to install the same project on my CentOS 7.9 VM, I get some error related to node-gyp. I tried following some steps on other threads but nothing solves my problem. I have also removed zeromq from package.json, deleted package-lock.json, and cleared my npm cache so that I can try a fresh installation of zeromq:
npm install zeromq
Here is the error log:
npm ERR! code 1
npm ERR! path /home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq
npm ERR! command failed
npm ERR! command sh -c -- (shx test -f ./script/build.js || run-s build.js) && cross-env npm_config_build_from_source=true node-gyp-build
npm ERR! make: Entering directory `/home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq/build'
npm ERR! TOUCH 7722eaf02fcc073df28ffd1fa831e71544edfd42.intermediate
npm ERR! ACTION binding_gyp_libzmq_target_build_libzmq 7722eaf02fcc073df28ffd1fa831e71544edfd42.intermediate
npm ERR! Downloading libzmq source from https://github.com/zeromq/libzmq/archive/20de92ac0a2b2b9a1869782a429df68f93c3625e.tar.gz
npm ERR! Building libzmq Release
npm ERR! cmake -S "libzmq-20de92ac0a2b2b9a1869782a429df68f93c3625e" -B ./build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX="/home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq/build/libzmq" -DCMAKE_INSTALL_LIBDIR=lib -DBUILD_STATIC=ON -DBUILD_TESTS=OFF -DBUILD_SHARED=OFF -DWITH_DOCS=OFF -DWITH_LIBSODIUM=ON -DWITH_LIBSODIUM_STATIC=ON
npm ERR! cmake --build ./build --config Release --target install
npm ERR! TOUCH Release/obj.target/libzmq.stamp
npm ERR! CXX(target) Release/obj.target/zeromq/src/context.o
npm ERR! rm 7722eaf02fcc073df28ffd1fa831e71544edfd42.intermediate
npm ERR! make: Leaving directory `/home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq/build'
npm ERR! /lib64/libc.so.6: version `GLIBC_2.33' not found (required by /home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq/prebuilds/linux-x64/node.napi.glibc.node)
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#9.1.0
npm ERR! gyp info using node#16.18.1 | linux | x64
npm ERR! gyp info find Python using Python version 3.6.8 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/fsmdevuser/fsm-poc/web-app/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/fsmdevuser/.cache/node-gyp/16.18.1/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/fsmdevuser/.cache/node-gyp/16.18.1',
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/fsmdevuser/.cache/node-gyp/16.18.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/fsmdevuser/fsm-poc/web-app/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! /bin/sh: cmake: command not found
npm ERR! /bin/sh: cmake: command not found
npm ERR! g++: error: unrecognized command line option ‘-std=gnu++14’
npm ERR! g++: error: unrecognized command line option ‘-std=c++17’
npm ERR! make: *** [Release/obj.target/zeromq/src/context.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:201:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:293:12)
npm ERR! gyp ERR! System Linux 3.10.0-1160.76.1.el7.x86_64
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/fsmdevuser/fsm-poc/web-app/node_modules/zeromq
npm ERR! gyp ERR! node -v v16.18.1
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /home/fsmdevuser/.npm/_logs/2023-01-30T08_31_00_652Z-debug-0.log
If it helps, my Node version is 16.18.1, npm is 8.19.2 and node-gyp --version returns 0.10.6
Edit:
I attempted to sudo yum install cmake to see if it fixes anything and now I'm getting a shorter error message
npm ERR! code 126
npm ERR! path /home/fsmdevuser/fsm-poc/web-app/node_modules/zeromq
npm ERR! command failed
npm ERR! command sh -c -- (shx test -f ./script/build.js || run-s build.js) && cross-env npm_config_build_from_source=true node-gyp-build
npm ERR! sh: /home/fsmdevuser/fsm-poc/web-app/node_modules/.bin/cross-env: Permission denied
npm ERR! A complete log of this run can be found in:
npm ERR! /home/fsmdevuser/.npm/_logs/2023-01-30T08_50_27_526Z-debug-0.log
I had the same issue yesterday with another package heapdump on Ubuntu 22. The solution is to install node-gyp globally:
sudo npm install -g node-gyp

Getting a sharp libvips npm install error (MacOS)

I am trying to run npm install for my Gatsby project on macOS Ventura.
sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)
I've looked through all of the previous tickets relating to this error and tried the fixes. For example, I've tried deleting the tar.br file (previous post had tar.bg), installing vips via HomeBrew, and installing sharp via npm and sharp (npm failed but yarn worked after some tinkering).
I have node version 18.9 and sharp version 0.31.1. This is what I have set in my package.json: "gatsby-plugin-sharp": "^2.3.5", "gatsby-transformer-sharp": "^2.3.7"
Any help is appreciated! Thank you so much!!
The error seems to be coming from the gatsby-transformer-sharp module:
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
The error message suggests that prebuilt libvips 8.10.5 binaries are not available for the architecture "darwin-arm64v8" and it's attempting to build from source via node-gyp.
To resolve the issue, you can follow the steps mentioned in the sharp installation guide: https://sharp.pixelplumbing.com/install and install the required dependencies. It may also be helpful to check if your version of Node.js is compatible with the latest version of the sharp package.

Problems installing argon2 in a project with npm

I'm having some issue's installing argon2 npm package in my project. I am a bit of a beginner and have tried to check everything:
To start this is my system:
MacBook Air m1 6 months old
Python
3.10.2
Clang
Apple clang version 13.1.6 (clang-1316.0.21.2.5)
Target: arm64-apple-darwin21.5.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
Make
GNU Make 3.81
This program built for i386-apple-darwin11.3.0
Installed:
sudo npm install -g node-gyp
within the package but globally
If I go inside the node-gyp folder:
node-gyp#9.0.0 /usr/local/lib/node_modules/node-gyp
node#17.6.0
So it looks like I have everything to get it running.
After the command for argon2:
npm i argon2
npm ERR! code 1
npm ERR! path /Users/billy/Wild Code School/Express/MVC_architecture/Express-----
Quests/node_modules/argon2
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build
npm ERR! CC(target) Release/obj.target/libargon2/argon2/src/ref.o
npm ERR! CC(target) Release/obj.target/libargon2/argon2/src/argon2.o
npm ERR! CC(target) Release/obj.target/libargon2/argon2/src/core.o
npm ERR! CC(target) Release/obj.target/libargon2/argon2/src/blake2/blake2b.o
npm ERR! CC(target) Release/obj.target/libargon2/argon2/src/thread.o
npm ERR! CC(target) Release/obj.target/libargon2/argon2/src/encoding.o
npm ERR! LIBTOOL-STATIC Release/argon2.a
npm ERR! CXX(target) Release/obj.target/argon2/src/argon2_node.o
npm ERR! Failed to execute '/usr/local/bin/node
/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --
fallback-to-build --module=/Users/billy/Wild Code
School/Express/MVC_architecture/Express-Quests/node_modules/argon2/lib/binding/napi-
v3/argon2.node --module_name=argon2 --module_path=/Users/billy/Wild Code
School/Express/MVC_architecture/Express-Quests/node_modules/argon2/lib/binding/napi-
v3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --
node_napi_label=napi-v3' (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.9
npm ERR! node-pre-gyp info using node#17.6.0 | darwin | arm64
npm ERR! node-pre-gyp info check checked for "/Users/billy/Wild Code
School/Express/MVC_architecture/Express-Quests/node_modules/argon2/lib/binding/napi-
v3/argon2.node" (not found)
npm ERR! node-pre-gyp http GET https://github.com/ranisalt/node-
argon2/releases/download/v0.28.5/argon2-v0.28.5-napi-v3-darwin-arm64-unknown.tar.gz
npm ERR! node-pre-gyp ERR! install response status 404 Not Found on
https://github.com/ranisalt/node-argon2/releases/download/v0.28.5/argon2-v0.28.5-
napi-v3-darwin-arm64-unknown.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for argon2#0.28.5 and
node#17.6.0 (node-v102 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/ranisalt/node-argon2/releases/download/v0.28.5/argon2-v0.28.5-
napi-v3-darwin-arm64-unknown.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#8.4.1
npm ERR! gyp info using node#17.6.0 | darwin | arm64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#8.4.1
npm ERR! gyp info using node#17.6.0 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.10.2 found at
"/Library/Frameworks/Python.framework/Versions/3.10/bin/python3"
npm ERR! gyp info spawn
/Library/Frameworks/Python.framework/Versions/3.10/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/usr/local/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/billy/Wild Code
School/Express/MVC_architecture/Express-
Quests/node_modules/argon2/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/usr/local/lib/node_modules/npm/node_modules/node-
gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/billy/Library/Caches/node-
gyp/17.6.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/billy/Library/Caches/node-
gyp/17.6.0',
npm ERR! gyp info spawn args '-
Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/billy/Library/Caches/node-
gyp/17.6.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/billy/Wild Code
School/Express/MVC_architecture/Express-Quests/node_modules/argon2',
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#8.4.1
npm ERR! gyp info using node#17.6.0 | darwin | arm64
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! clang: error: no such file or directory: 'Code'
npm ERR! clang: error: no such file or directory:
'School/Express/MVC_architecture/Express-Quests/node_modules/node-addon-api'
npm ERR! make: *** [Release/obj.target/argon2/src/argon2_node.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/local/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 Darwin 21.5.0
npm ERR! gyp ERR! command "/usr/local/bin/node"
"/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--
fallback-to-build" "--module=/Users/billy/Wild Code
School/Express/MVC_architecture/Express-Quests/node_modules/argon2/lib/binding/napi-
v3/argon2.node" "--module_name=argon2" "--module_path=/Users/billy/Wild Code
School/Express/MVC_architecture/Express-Quests/node_modules/argon2/lib/binding/napi-
v3" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=3" "--
node_napi_label=napi-v3"
npm ERR! gyp ERR! cwd /Users/billy/Wild Code
School/Express/MVC_architecture/Express-Quests/node_modules/argon2
npm ERR! gyp ERR! node -v v17.6.0
npm ERR! gyp ERR! node-gyp -v v8.4.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 '/usr/local/bin/node
/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --
fallback-to-build --module=/Users/billy/Wild Code
School/Express/MVC_architecture/Express-Quests/node_modules/argon2/lib/binding/napi-
v3/argon2.node --module_name=argon2 --module_path=/Users/billy/Wild Code
School/Express/MVC_architecture/Express-Quests/node_modules/argon2/lib/binding/napi-
v3 --napi_version=8 --node_abi_napi=napi --napi_build_version=3 --
node_napi_label=napi-v3' (1)
npm ERR! node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/billy/Wild
Code School/Express/MVC_architecture/Express-Quests/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:1090: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 21.5.0
npm ERR! node-pre-gyp ERR! command "/usr/local/bin/node" "/Users/billy/Wild Code
School/Express/MVC_architecture/Express-Quests/node_modules/.bin/node-pre-gyp"
"install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd /Users/billy/Wild Code
School/Express/MVC_architecture/Express-Quests/node_modules/argon2
npm ERR! node-pre-gyp ERR! node -v v17.6.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.9
npm ERR! node-pre-gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/billy/.npm/_logs/2022-06-10T13_25_52_362Z-debug-0.log

Why does the npm i command give an error to the terminal?

i am using npm i but it is making an error
npm ERR! code 1
npm ERR! path /home/nico/Desktop/myself/my-projects/trans/node_modules/kerberos
npm ERR! command failed
npm ERR! command sh -c prebuild-install || node-gyp rebuild
npm ERR! make: Entering directory &apos;/home/nico/Desktop/myself/my-projects/trans/node_modules/kerberos/build&apos;
npm ERR! CXX(target) Release/obj.target/kerberos/src/kerberos.o
npm ERR! make: Leaving directory &apos;/home/nico/Desktop/myself/my-projects/trans/node_modules/kerberos/build&apos;
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp#7.1.2
npm ERR! gyp info using node#15.12.0 | linux | x64
npm ERR! gyp info find Python using Python version 3.8.6 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 &apos;/home/nico/.nvm/versions/node/v15.12.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py&apos;,
npm ERR! gyp info spawn args &apos;binding.gyp&apos;,
npm ERR! gyp info spawn args &apos;-f&apos;,
npm ERR! gyp info spawn args &apos;make&apos;,
npm ERR! gyp info spawn args &apos;-I&apos;,
npm ERR! gyp info spawn args &apos;/home/nico/Desktop/myself/my-projects/trans/node_modules/kerberos/build/config.gypi&apos;,
npm ERR! gyp info spawn args &apos;-I&apos;,
npm ERR! gyp info spawn args &apos;/home/nico/.nvm/versions/node/v15.12.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi&apos;,
npm ERR! gyp info spawn args &apos;-I&apos;,
npm ERR! gyp info spawn args &apos;/home/nico/.cache/node-gyp/15.12.0/include/node/common.gypi&apos;,
npm ERR! gyp info spawn args &apos;-Dlibrary=shared_library&apos;,
npm ERR! gyp info spawn args &apos;-Dvisibility=default&apos;,
npm ERR! gyp info spawn args &apos;-Dnode_root_dir=/home/nico/.cache/node-gyp/15.12.0&apos;,
npm ERR! gyp info spawn args &apos;-Dnode_gyp_dir=/home/nico/.nvm/versions/node/v15.12.0/lib/node_modules/npm/node_modules/node-gyp&apos;,
npm ERR! gyp info spawn args &apos;-Dnode_lib_file=/home/nico/.cache/node-gyp/15.12.0/<(target_arch)/node.lib&apos;,
npm ERR! gyp info spawn args &apos;-Dmodule_root_dir=/home/nico/Desktop/myself/my-projects/trans/node_modules/kerberos&apos;,
npm ERR! gyp info spawn args &apos;-Dnode_engine=v8&apos;,
npm ERR! gyp info spawn args &apos;--depth=.&apos;,
npm ERR! gyp info spawn args &apos;--no-parallel&apos;,
npm ERR! gyp info spawn args &apos;--generator-output&apos;,
npm ERR! gyp info spawn args &apos;build&apos;,
npm ERR! gyp info spawn args &apos;-Goutput_dir=.&apos;
npm ERR! gyp info spawn args ]
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ &apos;BUILDTYPE=Release&apos;, &apos;-C&apos;, &apos;build&apos; ]
npm ERR! In file included from ../src/kerberos_common.h:7,
npm ERR! from ../src/kerberos.h:5,
npm ERR! from ../src/kerberos.cc:1:
npm ERR! ../src/unix/kerberos_gss.h:18:14: fatal error: gssapi/gssapi.h: No such file or directory
npm ERR! 18 | #include <gssapi/gssapi.h>
npm ERR! | ^~~~~~~~~~~~~~~~~
npm ERR! compilation terminated.
npm ERR! make: *** [kerberos.target.mk:114: Release/obj.target/kerberos/src/kerberos.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 (/home/nico/.nvm/versions/node/v15.12.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:369:20)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Linux 5.11.0-7612-generic
npm ERR! gyp ERR! command "/home/nico/.nvm/versions/node/v15.12.0/bin/node" "/home/nico/.nvm/versions/node/v15.12.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/nico/Desktop/myself/my-projects/trans/node_modules/kerberos
npm ERR! gyp ERR! node -v v15.12.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! /home/nico/.npm/_logs/2021-04-15T08_14_02_442Z-debug.log
Had the same problem on wsl2 (ubuntu) and volta. Solved by installing:
sudo apt-get install -y build-essential libkrb5-dev
And then:
npm install -g node-gyp make

Resources