My node.js
project has a dependency on node-sqlite
, but unfortunately the default libsqlite
binary embedded there was not built with options I need.
Now I can invoke npm install
on that package alone to get it to build correctly:
CFLAGS=-DSQLITE_ENABLE_STAT4 npm install sqlite3 --build-from-source
Essentially, this sets the environment variable and passes an option to the tool.
However, npm install
by itself should just install all the project dependencies, including sqlite. How do I encode package.json
or elsewhere so that npm install
will install the sqlite dependency with the above command line?
You could use a preinstall or a postinstall script to do this.
Put this in
scripts/install_sqlite3_from_source.sh
, and setscripts.preinstall
orscripts.postinstall
in yourpackage.json
to it.