Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can options be added to npm package.json dependencies?

I have a dependency with the sqlite3 package.

By default, upon install, the sqlite3 package downloads and uses a pre-packaged version of the sqlite3 engine. This can sometimes be a problem when using sqlite3 extensions so there is an option to install it with :

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

both "--build-from-source" and "--sqlite" are options that are handled by the sqlite3 package.

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

with

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

obviously i get the equivalent to

npm install sqlite3

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

like image 338
Jerome WAGNER Avatar asked Nov 15 '13 16:11

Jerome WAGNER


1 Answers

An alternative is to use the scripts member and setup the install script under the preinstall or postinstall hook:

"scripts": {
  "preinstall": "npm install --build-from-source --sqlite=/path/to/sqlite sqlite3"
},
like image 187
matth Avatar answered Oct 05 '22 18:10

matth