11
votes

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.

4

4 Answers

5
votes

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.

2
votes

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.

1
votes

This worked for me on Windows 10.

npm uninstall sqlite3
npm cache clean
npm install sqlite3
0
votes

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