gradle-nodejs-plugin icon indicating copy to clipboard operation
gradle-nodejs-plugin copied to clipboard

NODE_ENV

Open davthu opened this issue 6 years ago • 1 comments

It would be great if it was possible to set the NODE_ENV variable with this plugin. I tried like this but did not work:

task installNPM(type: NodeJsTask) {
    require = ["npm"]
    executable = "npm"
    args = ['NODE_ENV=production', 'install', '--no-save']
}

davthu avatar Jun 20 '19 08:06 davthu

I tried out another task that did not work:

task runSetup(type: NodeJsTask) {
    require = ["node"]
    executable = "node"
    args = ['NODE_ENV=production']
}
task installNPM(type: NodeJsTask, dependsOn: [runSetup]) {
    require = ["npm"]
    executable = "npm"
    args = ['install', '--no-save']
}

Gives an error:

Execution failed for task:
> Process 'command '/opt/.nodejs/10.15.0/bin/npm'' finished with non-zero exit value 1

davthu avatar Jun 20 '19 08:06 davthu