WiseLibs / better-sqlite3

The fastest and simplest library for SQLite3 in Node.js.
MIT License
5.47k stars 396 forks source link

gyp ERR! stack Error: `make` failed with exit code: 2 #332

Closed YoussefExplicit closed 4 years ago

YoussefExplicit commented 4 years ago

After running npm i better-sqlite3, I get:

integer@2.1.0 install /root/rep bot/node_modules/integer node-gyp rebuild

make: Entering directory '/root/rep bot/node_modules/integer/build' CXX(target) Release/obj.target/integer/src/integer.o SOLINK_MODULE(target) Release/obj.target/integer.node COPY Release/integer.node COPY ../build/integer.node TOUCH Release/obj.target/place_resulting_binary.stamp make: Leaving directory '/root/rep bot/node_modules/integer/build'

better-sqlite3@5.4.3 install /root/rep bot/node_modules/better-sqlite3 node-gyp rebuild

make: Entering directory '/root/rep bot/node_modules/better-sqlite3/build' TOUCH b857c92884e9598d609f6be182a2595df7a8e00f.intermediate ACTION deps_sqlite3_gyp_locate_sqlite3_target_extract_sqlite3 b857c92884e9598d609f6be182a2595df7a8e00f.intermediate /bin/sh: 1: bot/node_modules/better-sqlite3/build/Release/lib.host:/root/rep: not found /root/rep bot/node_modules/better-sqlite3/deps/extract.js:8 process.on('unhandledRejection', (err) => { throw err; }); ^

CwdError: ENOENT: Cannot cd into '/root/rep bot/node_modules/better-sqlite3/build/Release/obj/gen/sqlite3' at /root/rep bot/node_modules/tar/lib/mkdir.js:74:14 at FSReqCallback.oncomplete (fs.js:158:21) { path: '/root/rep bot/node_modules/better-sqlite3/build/Release/obj/gen/sqlite3', code: 'ENOENT' } deps/locate_sqlite3.target.mk:16: recipe for target 'b857c92884e9598d609f6be182a2595df7a8e00f.intermediate' failed make: *** [b857c92884e9598d609f6be182a2595df7a8e00f.intermediate] Error 1 rm b857c92884e9598d609f6be182a2595df7a8e00f.intermediate make: Leaving directory '/root/rep bot/node_modules/better-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:210:5) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12) gyp ERR! System Linux 4.4.0-138-generic gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" gyp ERR! cwd /root/rep bot/node_modules/better-sqlite3 gyp ERR! node -v v12.13.1 gyp ERR! node-gyp -v v5.0.5 gyp ERR! not ok npm WARN bootstrap@4.3.1 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself. npm WARN bootstrap@4.3.1 requires a peer of popper.js@^1.14.7 but none is installed. You must install peer dependencies yourself. npm WARN enmap@4.8.7 requires a peer of better-sqlite-pool@github:eslachance/better-sqlite-pool but none is installed. You must install peer dependencies yourself. npm WARN vouch-bot@1.0.0 No description npm WARN vouch-bot@1.0.0 No repository field.

npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! better-sqlite3@5.4.3 install: node-gyp rebuild npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the better-sqlite3@5.4.3 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/2019-12-15T18_17_43_934Z-debug.log

xctest commented 4 years ago

node-gyp fails too, and rebuild also fails

theflyingape commented 4 years ago

Same as #310 no? See my comment in regards: https://github.com/JoshuaWise/better-sqlite3/issues/310#issuecomment-565713865

JoshuaWise commented 4 years ago

The relevant part of that error appears to be CwdError: ENOENT: Cannot cd into '/root/rep bot/node_modules/better-sqlite3/build/Release/obj/gen/sqlite3', which is probably due to insufficient permissions in your file system.

TheNoob27 commented 4 years ago

so what should he do? well what should i do, as i also have this issue. even running the command as sudo npm i better-sqlite3 doesnt work

YoussefExplicit commented 4 years ago

i think i solved this issue by removing the space in the folder name i had a folder called rep bot, but renaming it to repbot solved the issue i believe

cekvenich commented 4 years ago

Let me know it this fixes it, run before install: npm i -g node-gyp@latest

coltoneshaw commented 3 years ago

I know this is an old issue, but anyone having this problem seems directly related to spaces in the folder path. Spent hours troubleshooting only to move it up to a folder without spaces and it worked flawlessly.