'GRAILS, ANGULAR, GRADLE --- Execution failed for task ':npmInstall'. --- npm finished with non-zero exit value 1

I am developing a project in IntelliJ and I am using Angular for the frontend and Grails for the backend. The project is being built with Gradle, and I am getting an error for the Gradle task npmInstall.

The error is:

Execution failed for task ':npmInstall'.
> Process 'command 'C:\Users\thomasplantin\Documents\Office\dev\projects-grails-5\lotBoxWashG5\.gradle\nodejs\node-v10.21.0-win-x64\npm.cmd'' finished with non-zero exit value 1

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

Does anyone know what is the source of this error? I tried looking online but couldn't find anything...



Solution 1:[1]

Few general things I could suggest

Delete the node_modules existing folder and try npm install.

And also check whether suitable node.js is installed. If requires install node.js as part of workflow.

Solution 2:[2]

I had the same error and solved it by downgrading nodejs via nvm like explained here. However I had the luxury of my coworker telling me which version of nodejs he uses.

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 Pandiyan Cool
Solution 2 PhilipAllStar