node.js - How to pass options to dependent package installs for npm? -


my node.js project has dependency on node-sqlite, unfortunately default libsqlite binary embedded there not built options need.

now can invoke npm install on package alone build correctly:

cflags=-dsqlite_enable_stat4 npm install sqlite3 --build-from-source 

essentially, sets environment variable , passes option tool.

however, npm install should install all project dependencies, including sqlite. how encode package.json or elsewhere npm install install sqlite dependency above command line?

you use preinstall or postinstall script this.

#!/bin/bash  cflags=-dsqlite_enable_stat4 npm install sqlite3 --build-from-source; 

put in scripts/install_sqlite3_from_source.sh, , set scripts.preinstall or scripts.postinstall in package.json it.


Comments

Popular posts from this blog

c++ - llvm function pass ReplaceInstWithInst malloc -

Cross-Compiling Linux Kernel for Raspberry Pi - ${CCPREFIX}gcc -v does not work -

java.lang.NoClassDefFoundError When Creating New Android Project -