'Pass command line option to npm install in gradle node plugin

Using the gradle node plugin com.github.node-gradle.node, how do I pass a command line option to the NpmInstallTask?

Background: For security reasons, I want to pass "--ignore-scripts".



Solution 1:[1]

The npmCommand in NpmInstallTask inherited from NpmTask is a listProperty

If you set that to ["install", "--ignore-scripts"] it should be correctly passed

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 deepy