Can options be added depending on npm package.json?

I have a dependency on sqlite3 package.

By default, during installation, the sqlite3 package downloads and uses a pre-packaged version of the sqlite3 engine. Sometimes this can be a problem when using the sqlite3 extensions, so it is possible to install it with:

npm install --build-from-source --sqlite=/path/to/sqlite sqlite3 

both "--build-from-source" and "-sqlite" are the parameters that are processed by the sqlite3 package.

Now, how can I tell package.json to install my dependency with these options?

from

 "dependencies": { "sqlite3": "*" } 

obviously i get the equivalent

 npm install sqlite3 

but I cannot find a way to force the -build-from-source and -sqlite options for sqlite3 package

+7
npm sqlite3
source share
1 answer

An alternative is to use a member of scripts and install a script installation under the preinstall or postinstall application:

 "scripts": { "preinstall": "npm install --build-from-source --sqlite=/path/to/sqlite sqlite3" }, 
+6
source share

All Articles