24

I have a problem installing package in node.js. My version of npm is 2.14.3 and I need to install sqlite3 package. In my proyect path Im usign this command: "npm install sqlite3 --save" I have the next error:

npm WARN package.json [email protected] No description npm WARN package.json [email protected] No repository field. npm WARN package.json [email protected] No README data npm WARN package.json [email protected] No license field. /

[email protected] install /home/pi/Desktop/node-sqlite_Sockets/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-v46-linux-arm.tar.gz node-pre-gyp ERR! Pre-built binaries not found for [email protected] and [email protected] (node-v46 ABI) (falling back to source compile with node-gyp) make: Entering directory '/home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/build' ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c TOUCH Release/obj.target/deps/action_before_build.stamp CC(target) Release/obj.target/sqlite3/gen/sqlite-autoconf-3150000/sqlite3.o Release/obj/gen/sqlite-autoconf-3150000/sqlite3.c:199451:1: fatal error: opening dependency file ./Release/.deps/Release/obj.target/sqlite3/gen/sqlite-autoconf-3150000/sqlite3.o.d.raw: No such file or directory compilation terminated. deps/sqlite3.target.mk:120: recipe for target 'Release/obj.target/sqlite3/gen/sqlite-autoconf-3150000/sqlite3.o' failed make: *** [Release/obj.target/sqlite3/gen/sqlite-autoconf-3150000/sqlite3.o] Error 1 make: Leaving directory '/home/pi/Desktop/node-sqlite_Sockets/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/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23) gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit (events.js:172:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) gyp ERR! System Linux 4.4.21-v7+ 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=/home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/lib/binding/node-v46-linux-arm/node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=/home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/lib/binding/node-v46-linux-arm" gyp ERR! cwd /home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3 gyp ERR! node -v v4.1.0 gyp ERR! node-gyp -v v3.0.3 gyp ERR! not ok node-pre-gyp ERR! build error 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=/home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/lib/binding/node-v46-linux-arm/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/lib/binding/node-v46-linux-arm' (1) node-pre-gyp ERR! stack at ChildProcess. (/home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/node_modules/node-pre-gyp/lib/util/compile.js:83:29) node-pre-gyp ERR! stack at emitTwo (events.js:87:13) node-pre-gyp ERR! stack at ChildProcess.emit (events.js:172:7) node-pre-gyp ERR! stack at maybeClose (internal/child_process.js:817:16) node-pre-gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5) node-pre-gyp ERR! System Linux 4.4.21-v7+ node-pre-gyp ERR! command "/usr/local/bin/node" "/home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" node-pre-gyp ERR! cwd /home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3 node-pre-gyp ERR! node -v v4.1.0 node-pre-gyp ERR! node-pre-gyp -v v0.6.31 node-pre-gyp ERR! not ok 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=/home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/lib/binding/node-v46-linux-arm/node_sqlite3.node --module_name=node_sqlite3 --module_path=/home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/lib/binding/node-v46-linux-arm' (1) npm ERR! Linux 4.4.21-v7+ npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "sqlite3" "--save" npm ERR! node v4.1.0 npm ERR! npm v2.14.3 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! 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 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/Desktop/node-sqlite_Sockets/npm-debug.log

If I try to execute my node.js program I have the next error:

module.js:338 throw err; ^ Error: Cannot find module '/home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/lib/binding/node-v46-linux-arm/node_sqlite3.node' at Function.Module._resolveFilename (module.js:336:15) at Function.Module._load (module.js:286:25) at Module.require (module.js:365:17) at require (module.js:384:17) at Object. (/home/pi/Desktop/node-sqlite_Sockets/node_modules/sqlite3/lib/sqlite3.js:4:15) at Module._compile (module.js:434:26) at Object.Module._extensions..js (module.js:452:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Module.require (module.js:365:17)

After update (npm install -g npm)

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/npm npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules /usr/local/lib └── [email protected] npm ERR! Linux 4.4.21-v7+ npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/ npm" "install" "-g" "npm" npm ERR! node v4.1.0 npm ERR! npm v3.10.9 npm ERR! path /usr/local/lib/node_modules/npm npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall access npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm' npm ERR! at Error (native) npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/npm'] npm ERR! errno: -13, npm ERR!
code: 'EACCES', npm ERR! syscall: 'access', npm ERR! path: '/usr/local/lib/node_modules/npm' } npm ERR! npm ERR! Please try running this command again as root/Administrator. npm ERR! Please include the following file with any support request: npm ERR!
/home/pi/Desktop/node-sqlite_Sockets/npm-debug.log

Somebody know how to solve it? Thanks in advance!

Best regards.

1
  • check if sqlite3 supports your current nodejs version or not. this was my issue Commented Aug 25, 2021 at 14:08

7 Answers 7

13

have you installed sqlite3 before on another app? because your cached files could be corrupt. try to remove it from your cache with npm cache clean sqlite3 or clean your whole cache with npm cache clean and run the install script again.

Edit: after you edited your question. it seems to be a permission error. Try running the npm update with sudo npm install -g npm

Summary: It was a problem with an old npm version. The update to a newer version solved it by running sudo npm install -g npm.

Sign up to request clarification or add additional context in comments.

5 Comments

Chresse thanks for reply me :) I have done that you say me but I have the same error :S Can you think of anything else?
@Tecnico: have you successfull installed any other npm packages? otherwise try to update your npm with npm install -g npm
I can't. I have error. I update my question you can see.
@Tecnico: after your edit it seems like a permission error. run the update comand with sudo: sudo npm install -g npm
Solve! :) Thanks you very much!!
8

This worked for me on Windows 10.

npm uninstall sqlite3
npm cache clean
npm install sqlite3

3 Comments

Thanks, I was trying to install it on Visual Studio Code terminal, and this solution worked for me.
Thanks! After uninstall sqlite3 and install again solved the problem.
Had to install latest python, not sure if that in conjunction with these instructions solved my problem too
4

None of the answers in different stackoverflow threads worked for me.

I deleted the cache, deleted the lock file, installed another version of Node, updated NPM, etc., but none of them worked. Maybe my answer is off-topic, But if you just want to get the job done right now, you may be able to install the package you want with another tool like yarn:

yarn add <package>

is equivalent to

npm i --save <package>

For example, SQLite3 and Sequelize could not be installed on my computer with NPM, which I could install with Yarn.

Comments

1

This worked for me:

  • Previously app directory was /My Files/TestApp and it always threw that error.
  • According to a suggestion on https://github.com/mapbox/node-sqlite3/issues/1538, I moved the directory to another directory that doesn't have spaces in the path (/FolderNameWithoutSpaces/TestApp)
  • And it worked

macOS Monterey v12.1 node version: v17.3.1 npm version: v8.3.0

This may not be the exact answer to the above question, but for some people, it will work.

2 Comments

I had the same error, and it was fixed by removing the spaces on the directory name. macOS Monterey (Apple M1 pro)
@Piumal1999 you are an absolute hero! thanks so much for your answer, i had tried everything previously but this finally fixed it for me. I shall never use spaces again!
1

On linux you should check that you have python installed python --version, if not, you should check this https://stackoverflow.com/a/46245617/9477206

Comments

1

Edit on 2022 : Please check the supported version of Node in sqlite npm documentation and use the supported Node version (mostly by downgrading using nvm)

For me the node verion is v16.x whereas the Sqlite max supported version is v12.x, so I downgraded and the issues went off!

Comments

-1

This worked for me:

  • First, I had Visual C++ 2013 installed, then configured globally by running npm config set msvs_version 2013 --global

  • Then I ran an installation of node-gyp by running npm install node-gyp -g node-gyp

  • Finally, I installed Sqlite3 by running npm install sqlite3

Hope this helps someone as it had helped me

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.