task npmInstallPkg(type: NpxTask){
doLast{
//install node packages from package.json
dependsOn npmInstall
//install pkg globally
command = 'npm'
args = ['install', '-g', 'pkg']
}
}
Whenever I try to execute the above task, I get below error :
A problem was found with the configuration of task ':npmInstallPkg'.
> No value has been specified for property 'command'.
I am using the "com.github.node-gradle.node" plugin version "2.2.4".
I have cross checked the syntax multiple times and haven't been able to find anything wrong with it. I created the task by referencing the plugin documentation at https://github.com/node-gradle/gradle-node-plugin/blob/2.2.4/docs/node.md#executing-npm-commands-via-npx
My node cofiguration block is as follows :
// gradle node plugin configuration
node {
// Version of node to use.
version = '10.14.1'
// Version of npm to use.
npmVersion = '6.4.1'
// Version of Yarn to use.
yarnVersion = '1.3.2'
// Base URL for fetching node distributions (change if you have a mirror).
distBaseUrl = 'https://nodejs.org/dist'
// If true, it will download node using above parameters.
// If false, it will try to use globally installed node.
download = true
// Set the work directory for unpacking node
workDir = file("${project.buildDir}/nodejs")
// Set the work directory for NPM
npmWorkDir = file("${project.buildDir}/npm")
// Set the work directory for Yarn
yarnWorkDir = file("${project.buildDir}/yarn")
// Set the work directory where node_modules should be located
nodeModulesDir = file("${project.projectDir}")
}