Pass command line option to npm install in gradle node plugin

1.6k views Asked by At

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

2

There are 2 answers

0
deepy On

The npmCommand in NpmInstallTask inherited from NpmTask is a listProperty

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

0
LoganMzz On

You can use following snippet (as documented here):

npmInstall.args = ['--ignore-scripts']