Node-sqlite3: npm install fails

Created on 3 Jan 2017  Â·  27Comments  Â·  Source: mapbox/node-sqlite3

npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/Cellar/node/7.3.0/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v7.3.0
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE

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 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sqlite3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs sqlite3
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls sqlite3
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/herson/dev/electron-sqlite3/npm-debug.log
npm-debug.txt

Most helpful comment

Need to downgrade node version to 8.9.3
use NVM to manage more than one version
https://github.com/creationix/nvm
then install an old version:
nvm install 8.9.3
use in your open terminal:
nvm use 8.9.3
or set as default:
nvm alias default 8.9.3
verify the version with:
node -v
only now install sqlite 3
npm install sqlite3

All 27 comments

similar issue. see dump below.

pi@raspberrypi:~ $ sudo npm install sqlite3 -g

[email protected] install /usr/lib/node_modules/sqlite3
node-pre-gyp install --fallback-to-build

node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.8/node-v48-linux-arm.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v48 ABI) (falling back to source compile with node-gyp)
gyp WARN EACCES user "root" does not have permission to access the dev dir "/root/.node-gyp/6.9.4"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/lib/node_modules/sqlite3/.node-gyp"
make: Entering directory '/usr/lib/node_modules/sqlite3/build'
make: * No rule to make target '../.node-gyp/6.9.4/include/node/common.gypi', needed by 'Makefile'. Stop.
make: Leaving directory '/usr/lib/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:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.38-v7+
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/usr/lib/node_modules/sqlite3/lib/binding/node-v48-linux-arm/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/usr/lib/node_modules/sqlite3/lib/binding/node-v48-linux-arm"
gyp ERR! cwd /usr/lib/node_modules/sqlite3
gyp ERR! node -v v6.9.4
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/usr/bin/nodejs /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/lib/node_modules/sqlite3/lib/binding/node-v48-linux-arm/node_sqlite3.node --module_name=node_sqlite3 --module_path=/usr/lib/node_modules/sqlite3/lib/binding/node-v48-linux-arm' (1)
node-pre-gyp ERR! stack at ChildProcess. (/usr/lib/node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js:83:29)
node-pre-gyp ERR! stack at emitTwo (events.js:106:13)
node-pre-gyp ERR! stack at ChildProcess.emit (events.js:191:7)
node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:877:16)
node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
node-pre-gyp ERR! System Linux 4.4.38-v7+
node-pre-gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd /usr/lib/node_modules/sqlite3
node-pre-gyp ERR! node -v v6.9.4
node-pre-gyp ERR! node-pre-gyp -v v0.6.31
node-pre-gyp ERR! not ok
Failed to execute '/usr/bin/nodejs /usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --module=/usr/lib/node_modules/sqlite3/lib/binding/node-v48-linux-arm/node_sqlite3.node --module_name=node_sqlite3 --module_path=/usr/lib/node_modules/sqlite3/lib/binding/node-v48-linux-arm' (1)
npm ERR! Linux 4.4.38-v7+
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "sqlite3" "-g"
npm ERR! node v6.9.4
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE

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 'node-pre-gyp install --fallback-to-build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the sqlite3 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs sqlite3
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls sqlite3
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! /home/pi/npm-debug.log

Assistance would be greatly appreciated. updated, dist-upgraded, npm install npm -g etc tried

I managed to find a work-around for the problem
run the installation of sqlite3 with the --unsafe-perm setting
sudo npm install --unsafe-perm -g sqlite3
it provides the necessary permissions to node-pre-gyp to do what it has to...

--unsafe-perm didn't work for me so I had to install a previous version (3.1.4)

Same issue...

node-pre-gyp ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.8/node-v48-linux-arm.tar.gz

same issue

 âš¡ âš™ root@default î‚° ~ î‚° npm i -g shadowsocks-manager
npm WARN deprecated [email protected]: In 6.x, the babel package has been deprecated in favor of babel-cli. Check https://opencollective.com/babel to support the Babel maintainers
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
/root/.nvm/versions/node/v6.11.1/bin/ssmgr -> /root/.nvm/versions/node/v6.11.1/lib/node_modules/shadowsocks-manager/bin/ssmgr

> [email protected] install /root/.nvm/versions/node/v6.11.1/lib/node_modules/shadowsocks-manager/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

sh: 1: node-pre-gyp: Permission denied
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/shadowsocks-manager/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"ia32"})

npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
npm ERR! spawn ENOENT
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!     /root/.npm/_logs/2017-07-28T06_48_07_397Z-debug.log

and --unsafe-perm solve the problem

I set npm set PYTHON=D:\location\of\python and installed the latest Microsoft Build Tools and it worked

I get this error when installing with npm install --no-bin-links which is required for supporting windows hosts in vagrant https://github.com/npm/npm/issues/7308

SAME ERROR
ERR! Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.8/node-v59-linux-x64.tar.gz

`> npm install --save [email protected]

> [email protected] install C:\Users\Cosmin\Desktop\304CEM   Web API\304CEM---Project\server\node_modules\sqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp info it worked if it ends with ok
node-pre-gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
node-pre-gyp verb cli   'C:\\Users\\Cosmin\\Desktop\\304CEM   Web API\\304CEM---Project\\server\\node_modules\\sqlite3\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp',
node-pre-gyp verb cli   'install',
node-pre-gyp verb cli   '--fallback-to-build' ]
node-pre-gyp info using [email protected]
node-pre-gyp info using [email protected] | win32 | x64
node-pre-gyp verb command install []
node-pre-gyp info check checked for "C:\Users\Cosmin\Desktop\304CEM   Web API\304CEM---Project\server\node_modules\sqlite3\lib\binding\node-v59-win32-x64\node_sqlite3.node" (not found)
node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.4/node-v59-win32-x64.tar.gz
node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.4/node-v59-win32-x64.tar.gz
node-pre-gyp ERR! Tried to download: https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.4/node-v59-win32-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v59 ABI) (falling back to source compile with node-gyp)
node-pre-gyp http 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.4/node-v59-win32-x64.tar.gz
node-pre-gyp verb command build [ 'rebuild' ]
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Users\Cosmin\AppData\Local\Programs\Python\Python36-32\python.exe", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Users\Cosmin\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\Cosmin\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack     at C:\Users\Cosmin\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:166:21)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Cosmin\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\Cosmin\\Desktop\\304CEM   Web API\\304CEM---Project\\server\\node_modules\\sqlite3\\lib\\binding\\node-v59-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\\Users\\Cosmin\\Desktop\\304CEM   Web API\\304CEM---Project\\server\\node_modules\\sqlite3\\lib\\binding\\node-v59-win32-x64" "--python=C:\\Users\\Cosmin\\AppData\\Local\\Programs\\Python\\Python36-32\\python.exe"
gyp ERR! cwd C:\Users\Cosmin\Desktop\304CEM   Web API\304CEM---Project\server\node_modules\sqlite3
gyp ERR! node -v v9.1.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Cosmin\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\Cosmin\Desktop\304CEM   Web API\304CEM---Project\server\node_modules\sqlite3\lib\binding\node-v59-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\Users\Cosmin\Desktop\304CEM   Web API\304CEM---Project\server\node_modules\sqlite3\lib\binding\node-v59-win32-x64 --python=C:\Users\Cosmin\AppData\Local\Programs\Python\Python36-32\python.exe' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\Cosmin\Desktop\304CEM   Web API\304CEM---Project\server\node_modules\sqlite3\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at emitTwo (events.js:135:13)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:224:7)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:943:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:220:5)
node-pre-gyp ERR! System Windows_NT 10.0.16299
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\Cosmin\\Desktop\\304CEM   Web API\\304CEM---Project\\server\\node_modules\\sqlite3\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\Users\Cosmin\Desktop\304CEM   Web API\304CEM---Project\server\node_modules\sqlite3
node-pre-gyp ERR! node -v v9.1.0
node-pre-gyp ERR! node-pre-gyp -v v0.6.28
node-pre-gyp ERR! not ok
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\Cosmin\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\Cosmin\Desktop\304CEM   Web API\304CEM---Project\server\node_modules\sqlite3\lib\binding\node-v59-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\Users\Cosmin\Desktop\304CEM   Web API\304CEM---Project\server\node_modules\sqlite3\lib\binding\node-v59-win32-x64 --python=C:\Users\Cosmin\AppData\Local\Programs\Python\Python36-32\python.exe' (1) npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

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!     C:\Users\Cosmin\AppData\Roaming\npm-cache\_logs\2017-12-11T14_06_53_566Z-debug.log`

Been trying to fix it for the last 3 days. I don't have any ideas left. Any help, please ?

Thanks.

@pestec try
npm i sqlite3 --build-from-source
worked for me

Need to downgrade node version to 8.9.3
use NVM to manage more than one version
https://github.com/creationix/nvm
then install an old version:
nvm install 8.9.3
use in your open terminal:
nvm use 8.9.3
or set as default:
nvm alias default 8.9.3
verify the version with:
node -v
only now install sqlite 3
npm install sqlite3

About missing arm binary there is a specific thread:

403 fetching precompiled binary #918

https://github.com/mapbox/node-sqlite3/issues/918

About rebuilding:

sqlite buildprocess needs a lot of memory on raspberryPI3 #942

https://github.com/mapbox/node-sqlite3/issues/942

@treedbox worked perfectly for me. thanks

@treedbox thank you!

The errors reported here are all various and from different issues. Anyone hitting this please:

If you are on ARM, we don't support binaries yet for easy install, so see #418

@treedbox thank you!

Need to downgrade node version to 8.9.3
use NVM to manage more than one version
https://github.com/creationix/nvm
then install an old version:
nvm install 8.9.3
use in your open terminal:
nvm use 8.9.3
or set as default:
nvm alias default 8.9.3
verify the version with:
node -v
only now install sqlite 3
npm install sqlite3

can't downgrade the node version just for one node module. It's better to fix the issue then downgrade the node version

above comment solved problem as of 4/22/2019
I just did nvm install 8.9.3 && nvm use 8.9.3 && npm install in the project I needed to work on. All good!

its working indeed thanks

@treedbox Thank you so much! Worked for me, in combination with --unsafe-perm

sqlite version 3 is the issue, upgraded to version 4 and everything is ok. Also updated from node 6 to 10.

@treedbox Worked for me! Thank you!

ok, I solved this issue with these steps:

  1. installed python 2.7:
    apt-get install python2.7
    ln -s /usr/bin/python2.7 /usr/bin/python
  2. installed sqlite from sources(amazon link doesn't work):
    npm i [email protected] --build-from-source

@serhii-zhydel: Fails on CentOS 7 for me:

gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/covid/.nvm/versions/node/v13.13.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 3.10.0-1062.12.1.el7.x86_64
gyp ERR! command "/home/covid/.nvm/versions/node/v13.13.0/bin/node" "/home/covid/.nvm/versions/node/v13.13.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--module=/home/covid/reactplay/fullstack-react-code/node_modules/sqlite3/lib/binding/node-v79-linux-x64/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/home/covid/reactplay/fullstack-react-code/node_modules/sqlite3/lib/binding/node-v79-linux-x64"
gyp ERR! cwd /home/covid/reactplay/fullstack-react-code/node_modules/sqlite3
gyp ERR! node -v v13.13.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok 

This after a long list of warnings and errors.

Unfortunate how _node people_ rely on this node-pre-gyp mess. The prebuilt binary link is broken (https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v3.1.8/node-v59-linux-x64.tar.gz), then it has to build sqlite from source, which the install script actually requires python to succeed.

Was this page helpful?
0 / 5 - 0 ratings