TryGhost / node-sqlite3

SQLite3 bindings for Node.js
BSD 3-Clause "New" or "Revised" License
6.22k stars 815 forks source link

Error during sqlite3 installation in Termux #1491

Closed LansUilson closed 2 years ago

LansUilson commented 3 years ago

Hello, when I install sqlite3 in Termux, after > node-pre-gyp install --fallback-to-build there is a warning about the absence of pre-built binaries, and after there are errors that I don't understand:

$ npm install sqlite3@5.0.2
npm WARN deprecated node-pre-gyp@0.11.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap. > sqlite3@5.0.2 install /storage/emulated/0/Bots/Test/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/v5.0.2/napi-v3-android-arm.tar.gz node-pre-gyp WARN Pre-built binaries not found for sqlite3@5.0.2 and node@14.15.4 (node-v83 ABI, unknown) (falling back to source compile with node-gyp) make: Entering directory '/storage/emulated/0/Bots/Test/node_modules/sqlite3/build' CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o AR(target) Release/obj.target/../node-addon-api/nothing.a COPY Release/nothing.a ACTION deps_sqlite3_gyp_action_before_build_target_unpack_sqlite_dep Release/obj/gen/sqlite-autoconf-3340000/sqlite3.c TOUCH Release/obj.target/deps/action_before_build.stamp CC(target) Release/obj.target/sqlite3/gen/sqlite-autoconf-3340000/sqlite3.o Release/obj/gen/sqlite-autoconf-3340000/sqlite3.c:744:17: warning: suspicious concatenation of string literals in an array initialization; did you mean to separate the elements with a comma? [-Wstring-concatenation] "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE), ^ , Release/obj/gen/sqlite-autoconf-3340000/sqlite3.c:56:27: note: expanded from macro 'CTIMEOPT_VAL' #define CTIMEOPT_VAL(opt) CTIMEOPTVAL(opt) ^ Release/obj/gen/sqlite-autoconf-3340000/sqlite3.c:55:28: note: expanded from macro 'CTIMEOPTVAL' #define CTIMEOPTVAL(opt) #opt ^ :5:1: note: expanded from here "1" ^ Release/obj/gen/sqlite-autoconf-3340000/sqlite3.c:744:3: note: place parentheses around the string literal to silence warning "THREADSAFE=" CTIMEOPT_VAL(SQLITE_THREADSAFE), ^ 1 warning generated. AR(target) Release/obj.target/deps/sqlite3.a COPY Release/sqlite3.a CXX(target) Release/obj.target/node_sqlite3/src/backup.o ../src/backup.cc:179:9: warning: unused variable 'status' [-Wunused-variable] int status = napi_create_async_work( ^ ../src/backup.cc:252:5: warning: unused variable 'status' [-Wunused-variable] BACKUP_BEGIN(Step); ^ ../src/macros.h:182:9: note: expanded from macro 'BACKUP_BEGIN' int status = napi_create_async_work( \ ^ ../src/backup.cc:319:5: warning: unused variable 'status' [-Wunused-variable] BACKUP_BEGIN(Finish); ^ ../src/macros.h:182:9: note: expanded from macro 'BACKUP_BEGIN' int status = napi_create_async_work( \ ^ 3 warnings generated. CXX(target) Release/obj.target/node_sqlite3/src/database.o ../src/database.cc:153:9: warning: unused variable 'status' [-Wunused-variable] int status = napi_create_async_work( ^ ../src/database.cc:247:9: warning: unused variable 'status' [-Wunused-variable] int status = napi_create_async_work( ^ ../src/database.cc:560:9: warning: unused variable 'status' [-Wunused-variable] int status = napi_create_async_work( ^ ../src/database.cc:669:9: warning: unused variable 'status' [-Wunused-variable] int status = napi_create_async_work( ^ 4 warnings generated. CXX(target) Release/obj.target/node_sqlite3/src/node_sqlite3.o CXX(target) Release/obj.target/node_sqlite3/src/statement.o ../src/statement.cc:122:9: warning: unused variable 'status' [-Wunused-variable] int status = napi_create_async_work( ^ ../src/statement.cc:344:5: warning: unused variable 'status' [-Wunused-variable] STATEMENT_BEGIN(Bind); ^ ../src/macros.h:146:9: note: expanded from macro 'STATEMENT_BEGIN' int status = napi_create_async_work( \ ^ ../src/statement.cc:396:5: warning: unused variable 'status' [-Wunused-variable] STATEMENT_BEGIN(Get); ^ ../src/macros.h:146:9: note: expanded from macro 'STATEMENT_BEGIN' int status = napi_create_async_work( \ ^ ../src/statement.cc:468:5: warning: unused variable 'status' [-Wunused-variable] STATEMENT_BEGIN(Run); ^ ../src/macros.h:146:9: note: expanded from macro 'STATEMENT_BEGIN' int status = napi_create_async_work( \ ^ ../src/statement.cc:538:5: warning: unused variable 'status' [-Wunused-variable] STATEMENT_BEGIN(All); ^ ../src/macros.h:146:9: note: expanded from macro 'STATEMENT_BEGIN' int status = napi_create_async_work( \ ^ ../src/statement.cc:639:5: warning: unused variable 'status' [-Wunused-variable] STATEMENT_BEGIN(Each); ^ ../src/macros.h:146:9: note: expanded from macro 'STATEMENT_BEGIN' int status = napi_create_async_work( \ ^ ../src/statement.cc:766:5: warning: unused variable 'status' [-Wunused-variable] STATEMENT_BEGIN(Reset); ^ ../src/macros.h:146:9: note: expanded from macro 'STATEMENT_BEGIN' int status = napi_create_async_work( \ ^ 7 warnings generated. SOLINK_MODULE(target) Release/obj.target/node_sqlite3.node COPY Release/node_sqlite3.node COPY /storage/emulated/0/Bots/Test/node_modules/sqlite3/lib/binding/napi-v3-android-arm/node_sqlite3.node TOUCH Release/obj.target/action_after_build.stamp make: Leaving directory '/storage/emulated/0/Bots/Test/node_modules/sqlite3/build' npm WARN Test@1.0.0 No description npm WARN Test@1.0.0 No repository field.
+sqlite3@5.0.2 added 43 packages from 109 contributors and audited 146 packages in 451.474s 5 packages are looking for funding run npm fund for details found 2 high severity vulnerabilities run npm audit fix to fix them, or npm audit for details

Yes, it is installed, but when you run code with sqlite3, it throws an error:

$ node test                         
internal/modules/cjs/loader.js:1122                 
return process.dlopen(module, path.toNamespacedPath(filename));
^

Error: dlopen failed: couldn't map "/storage/emulated/0/Bots/Test/node_modules/sqlite3/lib/binding/napi-v3-android-arm/node_sqlite3.node" segment 1: Permission denied
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1122:18)                         
    at Module.load (internal/modules/cjs/loader.js:928:32)                                              
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)                                    
    at Module.require (internal/modules/cjs/loader.js:952:19)                                           
    at require (internal/modules/cjs/helpers.js:88:18)                                                  
    at Object.<anonymous> (/storage/emulated/0/Bots/Test/node_modules/sqlite3/lib/sqlite3-binding.js:4:15)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)

test.js:

var sqlite3 = require('sqlite3').verbose();
var db = new sqlite3.Database('db.sqlite3');

Thanks in advance for your help!

daniellockyer commented 2 years ago

Would you be able to try with v5.0.3? 🙂