mapbox / node-pre-gyp

Node.js tool for easy binary deployment of C++ addons
BSD 3-Clause "New" or "Revised" License
1.12k stars 263 forks source link

Have command line options take precedence over environment variables #629

Open MasterOdin opened 2 years ago

MasterOdin commented 2 years ago

Given the following command:

npm_config_runtime=electron node-pre-gyp install --runtime=node

I would expect that node-pre-gyp would install for the node runtime, but rather it uses the electron runtime.

Our use-case is that we have a .yarnrc that defines the environment variable, and were trying to run node-pre-gyp as part of a yarn run-script to install a native dependency for node for our CI pipeline for testing. I ended up creating a wrapper script around calling node-pre-gyp that deleted the npm_config_* environment variables that were overriding the option flags I was trying to use.