0

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?

Alexander Mills
  • 90,741
  • 139
  • 482
  • 817

1 Answers1

1

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 ...
Trott
  • 66,479
  • 23
  • 173
  • 212
  • 1
    Since `npm start` doesn't necessarily map to a single command but could instead be a pipeline of commands, multiple commands run in sequence, multiple commands connected via `&&` and/or `||` operators, etc., passing arguments has to be handled in a funky way. Consider using environment variables or configuration files for something more robust. – Trott May 07 '15 at 19:08