Search code examples
node.jsnconf

nconf is not working with NPM start command


I have these two node.js command line commands:

 $  NODE_ENV=dev_local npm start --fp data_for_testing/csvfile.csv --mptp map_ivr_itg
 $  NODE_ENV=dev_local node start_script --fp data_for_testing/csvfile.csv --mptp map_ivr_itg

I am using nconf the command line and environment variable parser for node.js.

The problem is the command line arguments --fp and --mptp seem to disappear when using npm start.

enter image description here

Furthermore, as an aside, does any program interpret --fp as a force flag, as NPM is warning?


Solution

  • Your command line flags (e.g., --fp) are being sent to npm and not the script that results from running npm start. To send them to the resulting script as arguments, first send -- by itself as an argument. That indicates that the remaining arguments are for the resulting script and not for npm itself.

    npm start -- --fp ...