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

Cannot set the value of read-only property 'version' for task ':npmSetup' of type

Open xavierdevairakkam opened this issue 2 years ago • 6 comments

  • What went wrong: An exception occurred applying plugin request [id: 'com.github.node-gradle.node', version: '3.5.1']

Failed to apply plugin 'com.github.node-gradle.node'. Could not create task ':npmSetup'. > Cannot set the value of read-only property 'version' for task ':npmSetup' of type com.github.gradle.node.npm.task.NpmSetupTask.

`node { // Versions of node , npm version = "14.15.1" npmVersion = "6.14.8"

    // Enabled the automatic download. False is the default (for now).
    download = true

}`

xavierdevairakkam avatar Mar 21 '23 18:03 xavierdevairakkam

The build is working fine with 2x versions (2.2.4) without any issues. But when I run the build with any of the 3x versions, I'm getting the above error.

The gradle version is 7.0 and JDK version is 8. I hope these are sufficient to run the 3x version as per the document.

xavierdevairakkam avatar Mar 21 '23 18:03 xavierdevairakkam

@xavierdevairakkam can you provide a complete reproducer? are you using kotlin dsl? then i would expect

node {
    version.set("16.14.0")

or the like

cdietrich avatar Mar 21 '23 18:03 cdietrich

It is groovy dsl @cdietrich . Here is my sample build.gradle content for your reference

plugins {
        id "com.github.node-gradle.node" version "3.5.1"
}

node {
	// Versions of node , npm
	version = "14.15.1"
	npmVersion = "6.14.8"

	// Enabled the automatic download. False is the default (for now).
	download = true
}

npm_run_build {
	inputs.file 'package.json'
}

task cleanDist(type: NpmTask) {
	args = ['run', 'clean']
}

assemble.dependsOn npm_run_build

task test(type: NpmTask) {
        dependsOn assemble
	args = ['run', 'test']
}

task build(type: NpmTask) {
	dependsOn clean
	dependsOn cleanDist
        dependsOn test
	args = ['run', 'build']
}

wrapper {
        gradleVersion = '7.0'
}

xavierdevairakkam avatar Mar 22 '23 07:03 xavierdevairakkam

i still cannot reproduce your problem with that snippet.

cdietrich avatar Mar 22 '23 07:03 cdietrich

Is it running fine for you? @cdietrich

xavierdevairakkam avatar Mar 22 '23 07:03 xavierdevairakkam

i had to add a clean task and an assembe task, and a package json but yes

cdietrich avatar Mar 22 '23 07:03 cdietrich