Strapi Error when running on Digital Ocean Server/Droplet - node.js

I have created a new droplet/server in Digital Ocean.
I also have installed node and npm in that droplet.
I then install and run the Strapi app on it.
Before actually running strapi...I first npm install inside the strapi folder
However I am getting a few errors that I think is related to sqlite and/or nvm node
npm ERR! code 1
npm ERR! path /home/bliss/strapi/node_modules/better-sqlite3
npm ERR! command failed
npm ERR! command sh -c prebuild-install || npm run build-release
npm ERR! > better-sqlite3#7.4.6 build-release
npm ERR! > node-gyp rebuild --release
npm ERR! prebuild-install WARN install No prebuilt binaries found (target=18.1.0 runtime=node arch=x64 libc= platform=linux)
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#18.1.0 | linux | x64
npm ERR! gyp info find Python using Python version 3.8.10 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 '/home/bliss/.nvm/versions/node/v18.1.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 '/home/bliss/strapi/node_modules/better-sqlite3/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/bliss/.nvm/versions/node/v18.1.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/bliss/.cache/node-gyp/18.1.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/bliss/.cache/node-gyp/18.1.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/home/bliss/.nvm/versions/node/v18.1.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/home/bliss/.cache/node-gyp/18.1.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/bliss/strapi/node_modules/better-sqlite3',
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 ERR! build error
npm ERR! gyp ERR! stack Error: not found: make
npm ERR! gyp ERR! stack at getNotFoundError (/home/bliss/.nvm/versions/node/v18.1.0/lib/node_modules/npm/node_modules/which/which.js:10:17)
npm ERR! gyp ERR! stack at /home/bliss/.nvm/versions/node/v18.1.0/lib/node_modules/npm/node_modules/which/which.js:57:18
npm ERR! gyp ERR! stack at new Promise (<anonymous>)
npm ERR! gyp ERR! stack at step (/home/bliss/.nvm/versions/node/v18.1.0/lib/node_modules/npm/node_modules/which/which.js:54:21)
npm ERR! gyp ERR! stack at /home/bliss/.nvm/versions/node/v18.1.0/lib/node_modules/npm/node_modules/which/which.js:71:22
npm ERR! gyp ERR! stack at new Promise (<anonymous>)
npm ERR! gyp ERR! stack at subStep (/home/bliss/.nvm/versions/node/v18.1.0/lib/node_modules/npm/node_modules/which/which.js:69:33)
npm ERR! gyp ERR! stack at /home/bliss/.nvm/versions/node/v18.1.0/lib/node_modules/npm/node_modules/which/which.js:80:22
npm ERR! gyp ERR! stack at /home/bliss/.nvm/versions/node/v18.1.0/lib/node_modules/npm/node_modules/isexe/index.js:42:5
npm ERR! gyp ERR! stack at /home/bliss/.nvm/versions/node/v18.1.0/lib/node_modules/npm/node_modules/isexe/mode.js:8:5
npm ERR! gyp ERR! System Linux 5.4.0-107-generic
npm ERR! gyp ERR! command "/home/bliss/.nvm/versions/node/v18.1.0/bin/node" "/home/bliss/.nvm/versions/node/v18.1.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
npm ERR! gyp ERR! cwd /home/bliss/strapi/node_modules/better-sqlite3
npm ERR! gyp ERR! node -v v18.1.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! /home/bliss/.npm/_logs/2022-05-09T08_55_30_731Z-debug-0.log
Strapi usually works out of the box....
I'm guessing it is my setup that is the problem...
or should I remove the better-sqlite package in dependency???
How to fix so I can do npm install without any 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

npm install issue in Mac M1 model

I am trying to install npm in Mac m1 model but I keep getting the below error and I tried npm install --force but still error keeps occurring.
npm ERR! code 1
npm ERR! path /Users/anishbabu/Documents/platform/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! dlopen(/Users/anishbabu/Documents/platform/node_modules/zeromq/prebuilds/darwin-arm64/node.napi.glibc.node, 0x0001): Library not loaded: '/Users/runner/arm-target/opt/libsodium/lib/libsodium.23.dylib'
npm ERR! Referenced from: '/Users/anishbabu/Documents/platform/node_modules/zeromq/prebuilds/darwin-arm64/node.napi.glibc.node'
npm ERR! Reason: tried: '/Users/runner/arm-target/opt/libsodium/lib/libsodium.23.dylib' (no such file), '/usr/local/lib/libsodium.23.dylib' (no such file), '/usr/lib/libsodium.23.dylib' (no such file)
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#18.13.0 | darwin | arm64
npm ERR! gyp info find Python using Python version 3.11.0 found at "/Library/Frameworks/Python.framework/Versions/3.11/bin/python3"
npm ERR! gyp info spawn /Library/Frameworks/Python.framework/Versions/3.11/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/opt/homebrew/Cellar/node#18/18.13.0_1/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/anishbabu/Documents/platform/node_modules/zeromq/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/opt/homebrew/Cellar/node#18/18.13.0_1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/anishbabu/Library/Caches/node-gyp/18.13.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/anishbabu/Library/Caches/node-gyp/18.13.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/opt/homebrew/Cellar/node#18/18.13.0_1/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/anishbabu/Library/Caches/node-gyp/18.13.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/anishbabu/Documents/platform/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! Package libsodium was not found in the pkg-config search path.
npm ERR! Perhaps you should add the directory containing libsodium.pc' npm ERR! to the PKG_CONFIG_PATH environment variable npm ERR! No package 'libsodium' found npm ERR! gyp: Call to 'pkg-config libsodium --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/opt/homebrew/Cellar/node#18/18.13.0_1/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:284:16)
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:291:12)
npm ERR! gyp ERR! System Darwin 21.6.0
npm ERR! gyp ERR! command "/opt/homebrew/Cellar/node#18/18.13.0_1/bin/node" "/opt/homebrew/Cellar/node#18/18.13.0_1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/anishbabu/Documents/platform/node_modules/zeromq
npm ERR! gyp ERR! node -v v18.13.0
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok

Node-RED npm gyp fails node installation with exit code 1

I'm trying to install a Node-RED node from npm on my Raspberry pi.
However, unlike any other library/node, my installation fails using both npm from termina and the palette UI. I've tried this as root with no difference to the outcome.
The npm install command produces this:
npm ERR! code 1
npm ERR! path /home/pi/.node-red/node_modules/speaker
npm ERR! command failed
npm ERR! command sh /tmp/install-f29e4b28.sh
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.17.1 | linux | arm64
npm ERR! gyp info find Python using Python version 3.9.2 found at "/usr/bin/python3"
npm ERR! gyp WARN EACCES current user ("pi") does not have permission to access the dev dir "/root/.cache/node-gyp/16.17.1"
npm ERR! gyp WARN EACCES attempting to reinstall using temporary dev dir "/tmp/.node-gyp"
npm ERR! gyp http GET https://nodejs.org/download/release/v16.17.1/node-v16.17.1-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.17.1/node-v16.17.1-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v16.17.1/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v16.17.1/SHASUMS256.txt
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/pi/.node-red/node_modules/speaker/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 '/tmp/.node-gyp/16.17.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=/tmp/.node-gyp/16.17.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=/tmp/.node-gyp/16.17.1/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/pi/.node-red/node_modules/speaker',
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: name 'mpg123_cpu' is not defined while evaluating condition 'mpg123_cpu=="arm_nofpu"' in deps/mpg123/mpg123.gyp while loading dependencies of binding.gyp while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:261:16)
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:291:12)
npm ERR! gyp ERR! System Linux 5.15.72-v8+
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/pi/.node-red/node_modules/speaker
npm ERR! gyp ERR! node -v v16.17.1
npm ERR! gyp ERR! node-gyp -v v9.0.0
npm ERR! gyp ERR! not ok
I've tried with the parameters:
unsafe-perm=true
and
omit=dev
I've also tried downgrading my npm version and also purging the package-lock.json files. I've also tried reinstalling gyp to no avail.

Errors while Installing node_modules on Amazon Linux 2 AMI (HVM)

I installed nvm and npm on Amazon linux 2 and I pulled my code from github.
When I want to install node_modules, I get this Error:
npm ERR! code 1
npm ERR! path /home/ec2-user/RealeState/node_modules/iconv
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! make: Entering directory `/home/ec2-user/RealeState/node_modules/iconv/build'
npm ERR! CC(target) Release/obj.target/iconv/binding.o
npm ERR! make: Leaving directory `/home/ec2-user/RealeState/node_modules/iconv/build'
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#12.18.3 | linux | x64
npm ERR! gyp info find Python using Python version 3.7.10 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 '/home/ec2-user/.nvm/versions/node/v12.18.3/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/ec2-user/RealeState/node_modules/iconv/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/ec2-user/.nvm/versions/node/v12.18.3/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/ec2-user/.cache/node-gyp/12.18.3/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/ec2-user/.cache/node-gyp/12.18.3',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/home/ec2-user/.nvm/versions/node/v12.18.3/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/home/ec2-user/.cache/node-gyp/12.18.3/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/ec2-user/RealeState/node_modules/iconv',
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! make: cc: Command not found
npm ERR! make: *** [Release/obj.target/iconv/binding.o] Error 127
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/ec2-user/.nvm/versions/node/v12.18.3/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
npm ERR! gyp ERR! stack at ChildProcess.emit (events.js:315:20)
npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
npm ERR! gyp ERR! System Linux 4.14.232-177.418.amzn2.x86_64
npm ERR! gyp ERR! command "/home/ec2-user/.nvm/versions/node/v12.18.3/bin/node" "/home/ec2-user/.nvm/versions/node/v12.18.3/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /home/ec2-user/RealeState/node_modules/iconv
npm ERR! gyp ERR! node -v v12.18.3
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/ec2-user/.npm/_logs/2021-07-22T15_09_51_360Z-debug.log
Even I tried to give privileges to user but again it didn't work. Even I can not install any node packages each time I get the same error. I tried to upgrade my node, npm, and nvm version but again I got the same error. I would appreciate if you help me with this problem

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