Hello. I seem to be getting this error when running 'npm install' on Ubuntu 20.04, Node 12.16.3, and Raspberry Pi 4. I am building a Discord bot using Discord.js and updated to version 12 but I am having trouble getting SQLite3 to install. I'm not super familiar with Node.js errors so I'm not entirely sure what it's trying to tell me.
I can provide additional information as needed.
> [email protected] install /home/bondbot/server/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build
node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v72-linux-arm64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for [email protected] and [email protected] (node-v72 ABI, glibc) (falling back to source compile with node-gyp)
make: Entering directory '/home/bondbot/server/node_modules/sqlite3/build'
ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3310100/sqlite3.c
/bin/sh: 1: python: not found
make: *** [deps/action_before_build.target.mk:13: Release/obj/gen/sqlite-autoconf-3310100/sqlite3.c] Error 127
make: Leaving directory '/home/bondbot/server/node_modules/sqlite3/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:310:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 5.4.0-1008-raspi
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/bondbot/server/node_modules/sqlite3/lib/binding/node-v72-linux-arm64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/home/bondbot/server/node_modules/sqlite3/lib/binding/node-v72-linux-arm64" "--napi_version=5" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd /home/bondbot/server/node_modules/sqlite3
gyp ERR! node -v v12.16.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/bondbot/server/node_modules/sqlite3/lib/binding/node-v72-linux-arm64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/bondbot/server/node_modules/sqlite3/lib/binding/node-v72-linux-arm64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/home/bondbot/server/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:310:20)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
node-pre-gyp ERR! System Linux 5.4.0-1008-raspi
node-pre-gyp ERR! command "/usr/bin/node" "/home/bondbot/server/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /home/bondbot/server/node_modules/sqlite3
node-pre-gyp ERR! node -v v12.16.3
node-pre-gyp ERR! node-pre-gyp -v v0.11.0
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/node /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/home/bondbot/server/node_modules/sqlite3/lib/binding/node-v72-linux-arm64/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/bondbot/server/node_modules/sqlite3/lib/binding/node-v72-linux-arm64 --napi_version=5 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
npm WARN [email protected] requires a peer of @types/better-sqlite3@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of better-sqlite3@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of sqlite@^3.0.0 but none is installed. You must install peer dependencies yourself.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/bondbot/.npm/_logs/2020-05-16T02_38_41_644Z-debug.log
/bin/sh: 1: python: not found
Either you are missing python, which can be installed through
sudo apt-get install python3
Or you do have python, but the installation procedure isn't finding it.
Investigate the /usr/bin directory and look for a python directory, for example:
npm install --build-from-source --python=/usr/bin/python3
That was it. Thanks for the help. It installed correctly using the second command.
Wait wait wait..
Yes, of course this is a working answer, but the problem isnt addressed.
It's standard for Ubuntu and surely other recent Linux distributions, that there is no python command, only python2 or python3.
Install an Ubuntu 20.04 LTS for a proof.
Then type python.
Nothing happens
If people really think that they are missing python, when they dont, they tend to do:
sudo apt install python
But this package doesnt install python3, but a package called python-is-python2, to have the old default from years ago, that python links to python2. There is also a package python-is-python3, which links it to python3. But these are just workarounds.
There is a reason why there are now only the "python2" or "python3" commands - to force developers to make their intended choices.
That said, the build script luckily works with python2 and python3.
Here is a proper description of the current situation, which will be adopted by more and more operating systems in the future, because its a PEP.
https://techsparx.com/nodejs/install/bootstrap-drops-jquery.html
(dont be irritated by the name, its the right page)
Most helpful comment
Wait wait wait..
Yes, of course this is a working answer, but the problem isnt addressed.
It's standard for Ubuntu and surely other recent Linux distributions, that there is no python command, only python2 or python3.
Install an Ubuntu 20.04 LTS for a proof.
Then type python.
Nothing happens
If people really think that they are missing python, when they dont, they tend to do:
sudo apt install python
But this package doesnt install python3, but a package called python-is-python2, to have the old default from years ago, that python links to python2. There is also a package python-is-python3, which links it to python3. But these are just workarounds.
There is a reason why there are now only the "python2" or "python3" commands - to force developers to make their intended choices.
That said, the build script luckily works with python2 and python3.