Rakesh133
Rakesh133

Reputation: 381

NPM Package Error- 'newman' is not recognized as an internal or external command

I have installed the latest version of Newman (3.10.0) in my 64-Bit Win 10 Machine.

C:\Users\ABC>npm install -g newman
C:\Users\ABC\AppData\Roaming\npm\newman -> C:\Users\ABC\AppData\Roaming\npm\node_modules\newman\bin\newman.js
+ [email protected]
added 195 packages in 57.852s

However, I am not able to use the newman and I am getting below error while accessing.

C:\Users\ABC>newman -h
'newman' is not recognized as an internal or external command,
operable program or batch file.

I have added an environment variable for the NODE_PATH pointing to the newman directory C:\Users\ABC\AppData\Roaming\npm\node_modules\newman

but no luck. Could some one please help.

Upvotes: 7

Views: 20226

Answers (4)

Gaurav Khurana
Gaurav Khurana

Reputation: 3901

Adding in the Path variable under Environment Variable solve the problem even if we don't add in NODE_PATH

C:\Users\ yourusername \AppData\Roaming\npm

After doing this reopen command prompt

enter image description here

enter image description here

enter image description here

Upvotes: 8

ishaj
ishaj

Reputation: 101

I was also getting the same error and I have followed the below steps to troubleshoot it- 1. Know what user is running jenkins, a simple way is Create a jenkins job and in its Build section run the command whoami 2. If it shows System user, then do the following- 2.a. Set C:\Users\I823285\AppData\Roaming\npm and C:\Users\I823285\AppData\Roaming\npm\node_modules\newman\bin in SYSTEM ENV. VARIABLES. b. Restart Jenkins by running CMD as ADMIN, and go to Jenkins installation folder, then enter jenkins.exe restart. c. Re-build the project SUCCESSFUL!

Upvotes: 0

uBaH
uBaH

Reputation: 179

I have installed node, vc redist and newman once (on clear windows 7 64 bit) and the issue is looks like related to wrong newman installation. Both newman and node should be installed from administrator session (not just with admin privileges). I have installed newman from regular user, system path setting are correct, but user environment was not set:

path=C:\Users\gagarin\AppData\Roaming\npm

So I have copied

C:\Users\<regular_user>\AppData\Roaming\npm

to C:\Users\admin\AppData\Roaming\npm and run C:\Users\admin\AppData\Roaming\npm\newman.cmd from administrator session. After that newman command became work in admin session. Sadly it works in regular user session only if I type full path to newman like

Blockquote

c:> C:\Users\admin\AppData\Roaming\npm\newman run ....

Upvotes: 1

Rakesh133
Rakesh133

Reputation: 381

The issue was fixed after troubleshooting with the Node Application. A previous version of Node (32-bit) was installed in my machine and it was not completely removed after I did an uninstall. When I installed Node 64-Bit both entry was present in the environment variable and caused a conflict.

When I manually deleted both installation folder and the env variable the newman worked correcly.

Upvotes: 1

Related Questions