Cannot run newman on jenkins [newman :command not found] in AWS EC2 Linux Jenkin machine

Cannot run newman on jenkins [newman :command not found] in AWS EC2 Linux Jenkin machine

I am also getting same error but my Jenkin is in AWS EC2(Linux) , Please help me to resolve this.

In AWS CLI, I have installed node js and newman and could able to run newman commands but when i run same command from Jenkin UI which is present in same AWS EC2, I am getting below error

[Collection_run] $ /bin/sh -xe /tmp/jenkins7542658729538318661.sh
+ newman -version
/tmp/jenkins7542658729538318661.sh: line 2: newman: command not found
Build step ‘Execute shell’ marked build as failure
Finished: FAILURE

Please solve this

image

Still its working fine in AWS Command line terminal

A common issue with that Jenkins is probably using another user than you do.

Try opening a console and switching to the Jenkins user and after this trying to run newman.