build from source with npm 11.4.1 causes warnings "Unknown cli config "--build-from-source". This will stop working in the next major version of npm"
The commandline
$ npm install better-sqlite3 --build-from-source --sqlite3=$(pwd)/src/sqlite-amalgamation-3500100
produces the following warnings:
npm warn Unknown cli config "--build-from-source". This will stop working in the next major version of npm.
npm warn Unknown cli config "--sqlite3". This will stop working in the next major version of npm.
This happens after I had installed npm 11.4.1. With the former version npm 11.2.0 the warnings didn't appear. The program better-sqlite3 itself is built and runs without problems.
Because I didn't find another way to build better-sqlite3 from source I'm afraid of this warning ...
Thank you for your excellent work!
Frank
What is the actual usecase you are trying to cover by explicitly rebuilding from source using those flags? If npm / node-gyp are about to remove them, there is nothing this library can do about it.
If you just want to recompile the project itself, there are several scripts defined (e.g. npm run build-release). If you just want to add better-sqlite3 as a module, there is no need to build it from source, if you don't want to use some custom build.
I need some defines in the sqlite3 executable which are not included in the standard amalgamation. This is the patch I apply to sqlite3.c before compiling sqlite3:
*** sqlite3.c.orig 2024-04-24 11:29:51.092808403 +0200
--- sqlite3.c 2024-04-24 11:30:46.903073356 +0200
***************
*** 20,25 ****
--- 20,28 ----
** The content in this amalgamation comes from Fossil check-in
** 8653b758870e6ef0c98d46b3ace27849054a.
*/
+ #define SQLITE_ENABLE_MATH_FUNCTIONS 1
+ #define SQLITE_USE_URI 1
+ #define SQLITE_THREADSAFE 0
#define SQLITE_CORE 1
#define SQLITE_AMALGAMATION 1
#ifndef SQLITE_PRIVATE
I found this in the documentation: https://github.com/WiseLibs/better-sqlite3/blob/master/docs/compilation.md. If there is an another way to include in better-sqlite3 the functionality given by this defines, please tell me. Thanks in advance
After having studied node_modules/better-sqlite/deps/sq3lite.gyp I found a remedy (very ugly hack) to include the defines mentionned above: Install better-sqlite3 without any options:
npm install better-sqlite
Edit the file node_modules/better-sqlite3/deps/sqlite3/sqlite3.c and insert the defines you need and then:
cd node_modules/better-sqlite
../.bin/node-gyp rebuild --release
@mceachen: I've installed version 12.2.0, but the warnings haven't disappeared. Perhaps the documentation in https://github.com/WiseLibs/better-sqlite3/blob/master/docs/compilation.md should be adapted. Is there now an "official" way to integrate individual compile time flags in the sqlite3 source? I really don't see the cause why the issue has been closed and would appreciate a comment.
Gotcha, I misinterpreted the state of this issue.