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

I have protractor installed on windows slave machine. I am trying to run my script using node index.js. If I trigger job from jenkins to run above command it gives error like Protractor is not recognized as an internal or external command, operable program or batch file.. But when I run command directly on slave machine it execute it successfully.



Solution 1:[1]

You can use the Jenkins NodeJS plugin(https://wiki.jenkins-ci.org/display/JENKINS/NodeJS+Plugin) to install node and additional npm packages like protractor, grunt, etc.

After installing npm packages at global level, you can select the "Provide Node & npm bin/folder to PATH" checkbox to ensure you can run "protractor", "grunt" into shell or batch command.

Hope this helps.

Solution 2:[2]

I had same problem

  1. In jenkins, just go to same directory where protractor and webdriver file is present after installing npm install -g protractor
  2. like in build environment > cd go to same directory then
  3. run commands with node appended to them such as

node webdriver-manager start node protractor "path where config.js" is kept

This solution works for me!! Happy Automating

Solution 3:[3]

This Issue occurs because if you have installed the NodeJS after starting the Jenkins server.

The solution is simple: Restart your Jenkins Server

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nilesh
Solution 2 Abhishek Goel
Solution 3 sɐunıɔןɐqɐp