Search code examples
node.jswindowspostmanpostman-newman

Cannot run the newman command on windows 10


I tried to install newman globally but no luck and here is what I did: First I installed newman as follows: image.png Then I ran the command newman -h in another command prompt window: image.png

'newman' is not recognized as an internal or external command, operable program or batch file.

I looked for the newman module in the following folders but I didn't find any:

  • C:\Users\my-username\AppData\Roaming\npm\node_modules
  • C:\Users\my-username\AppData\Roaming\npm
  • C:\Program Files\nodejs\node_modules\npm\node_modules

Any idea on how to solve this issue?


Solution

  • Cause:

    After spending some time trying to solve this, I found out that npm is not configured correctly, and it installs the module in another directory.

    Solution:

    Make sure that npm prefix is set to the path where NodeJs is installed using the following command:

    npm config get prefix

    enter image description here

    In my case, I already installed NodeJS before running npm install -g newman in the following path:

    enter image description here

    So what I did to solve the issue, is to run the following command:

    npm config set prefix "C:\Program Files\nodejs"

    enter image description here

    and then I re-installed Newman globally with npm install -g npm and that's all.

    enter image description here