Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLite3 Error - Ubuntu 20.04, Node 12.16.3, and Raspberry Pi 4 #1328

Closed
bmearnhardt opened this issue May 16, 2020 · 4 comments
Closed

SQLite3 Error - Ubuntu 20.04, Node 12.16.3, and Raspberry Pi 4 #1328

bmearnhardt opened this issue May 16, 2020 · 4 comments

Comments

@bmearnhardt
Copy link

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.

> sqlite3@4.2.0 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 sqlite3@4.2.0 and node@12.16.3 (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 discord.js-commando@0.11.0-dev requires a peer of @types/better-sqlite3@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js-commando@0.11.0-dev requires a peer of better-sqlite3@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js-commando@0.11.0-dev 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! sqlite3@4.2.0 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the sqlite3@4.2.0 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
@kewde
Copy link
Collaborator

kewde commented May 16, 2020

/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

@bmearnhardt
Copy link
Author

That was it. Thanks for the help. It installed correctly using the second command.

@kewde kewde closed this as completed May 17, 2020
@mpathy
Copy link

mpathy commented Jun 11, 2020

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.

@mpathy
Copy link

mpathy commented Jun 11, 2020

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)

diegoe added a commit to diegoe/node-sqlcipher that referenced this issue Mar 21, 2021
Modern Linux distributions do not alias `python` to python2. Ptyhon's
PEP394 goes into further detail, but _currently_ you should point to the
Python version you expect to find as `python`.

This fixes various FTBFS on modern Linux/macOS systems with no `python`
alias.

See: https://www.python.org/dev/peps/pep-0394/
See: TryGhost/node-sqlite3#1328
See: TryGhost/node-sqlite3#584
See: TryGhost/node-sqlite3#1443
diegoe added a commit to diegoe/node-sqlcipher that referenced this issue Mar 21, 2021
Modern Linux distributions do not alias `python` to python2. Ptyhon's
PEP394 goes into further detail, but _currently_ you should point to the
Python version you expect to find as `python`.

This fixes various FTBFS on modern Linux/macOS systems with no `python`
alias.

See: https://www.python.org/dev/peps/pep-0394/
See: TryGhost/node-sqlite3#1328
See: TryGhost/node-sqlite3#584
See: TryGhost/node-sqlite3#1443
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants