0

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
Marcin Natanek
  • 576
  • 3
  • 11

3 Answers3

0

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.

Marcin Natanek
  • 576
  • 3
  • 11
0

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

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;"

Thomas Brooks
  • 321
  • 3
  • 7