Search code examples
node.jsnpmpostmannewman

newman run -k <collection> -e <environment> is not running and it is throwing error


newman run -k <collection> -e <environment> is not running and it is throwing error like below,

"unable to read data from file "-k" ENOENT: no such file or directory, open 'D:\Development_Avecto\APIRegressionAuto mation\EnvironmentsAndCollections-k' "

enter image description here

can someone help on this please?

Note :

node version - v4.1.2
npm version - 2.15.12
newman version - 3.9.1

Solution

  • As per the docs - You do not require the -k flag for the collection reference.

    What newman is doing is looking for the first argument on the command line which it knows should be the collection file but it's finding -k instead and thinking that's the collection. So you get "unable to read data from file "-k"".

    You can just write:

    newman run <collection> -e <environment>

    -k is the alias for insecure and if you want this it needs to be added after the other flags.

    newman run <collection> -e <environment> -k