How to resolve grunt not recognizable error on jenkins whereas Grunt is running in command prompt?

552 Views Asked by At

How to resolve grunt not recognizable error on jenkins whereas Grunt is running in command prompt?

Jenkins output:

test cases will be executed
'grunt' is not recognized as an internal or external command, operable program or batch file.
Build step 'Execute Windows batch command' marked build as failure
Finished: FAILURE
3

There are 3 best solutions below

3
Marcin Natanek On

Most probably if the grunt-cli package is installed globally, you do not have the executable path added to system's PATH variable.

Or in the case when you do not have the package installed, npm install -g grunt-cli in windows shell.

0
Aayushi Brawed On

Issue was related to path,basically my user's path variable had npm and grunt paths but was missing from system path variable.So i added npm path to system path variable and it worked for jenkins!

0
Thomas Brooks On

In my case the path was defined correctly. It worked when I execute it on CMD, but not from Jenkins. Turns out it was due to Jenkins using its own managed path, as defined in Manage Jenkins -> Configure System -> Global Properties. Define Environment variable named "Path" there, and add the location of your npm directory to it, such as: "C:\Users\your-user-name\AppData\Roaming\npm;"