cancel
Showing results for 
Search instead for 
Did you mean: 

MTA Archive Builder fails to run grunt.cmd on Windows VM Jenkins Server

0 Kudos

I am in the process of configuring a Jenkins "Master Only" instance on a Windows Virtual Machine that will be used to build "Multi-Target Archives" for deployment to Neo. I am following the excellent blog CI Best Practices Guide – SAPUI5/SAP Fiori on SAP Cloud Platform as a reference. I want to get a standard scenario working before reverting to "Piper" pipelines.

I have created a simple "hello world" UI5 application to begin just to test the end to end connectivity, and trigger the "Multi Target Archive Builder", however the build fails when trying to run grunt.cmd (see below for log output) even though grunt.cmd is available in specified directory:

The build always:

1) retrieves application from Azure DevOps Git repository

2) Creates /src subfolder

3) Creates .npmrc

4) Triggers the "Multi Target Archive Builder"

5) But always fails when trying to trigger grunt.cmd with following error, even though grunt.cmd is available in the \node_modules\.bin referenced in the path

java.io.IOException: Cannot run program "grunt.cmd" (in directory "C:\Program Files (x86)\Jenkins\workspace\CI_SCPIV_HelloWorld_master_build\src\node_modules\.bin"): CreateProcess error=2, The system cannot find the file specified at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)

The content of mta.yaml, gruntfile.js and package.json are as follows:

Windows PowerShell "Build Step" - nb hardcoded paths for now:

# create local npmrc file

cd $ENV:WORKSPACE/src New-Item -type file -name ".npmrc"

"registry=https://registry.npmjs.org/" | Out-File ".npmrc"

-encoding ascii "@sap:registry=https://npm.sap.com/" | Out-File ".npmrc"

-encoding ascii -Append

# execute MTA build

java -jar C:\SCPIV\MTABuilder\mta_archive_builder.jar --mtar=scpivui5hello.mtar --build-target=NEO build

Jenkins Log

SAP Multitarget Application Archive Builder 1.1.8
Module "scpivui5hello": invoking npm install

Module "scpivui5hello": command output
>  audited 1428 packages in 8.751s
>  found 11 vulnerabilities (6 low, 5 moderate)
>    run `npm audit fix` to fix them, or `npm audit` for details
Module "scpivui5hello": invoking grunt
ERROR: An unexpected error has occurred; please tell us about it in our Community page: " https://answers.sap.com/tags/73554900100700001351";
Build step 'Windows PowerShell' marked build as failure
Archiving artifacts


Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

I have found the answer to my question. The Jenkins build job running on the Windows VM was failing to run grunt although evidence suggested grunt was available, and build job successfully ran npm commands. The manually selected instance of Node.JS was failing to run grunt.

Node.JS was removed completely from the Windows VM and reinstalled - grunt and grunt-cli were not deployed globally on the server this time.

Instead Jenkins Global Tool Configuration was updated to automatically install Node.JS including the global deployment of grunt and grunt-cli. The version of Node.JS deployed successfully by Jenkins worked successfully.

Answers (0)