Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xavierdevairakkam opened this issue Mar 21, 2023 · 6 comments

Comments

@xavierdevairakkam
Copy link

  • 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
Copy link
Author

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.

@cdietrich
Copy link
Contributor

cdietrich commented Mar 21, 2023

@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

@xavierdevairakkam
Copy link
Author

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'
}

@cdietrich
Copy link
Contributor

i still cannot reproduce your problem with that snippet.

@xavierdevairakkam
Copy link
Author

Is it running fine for you? @cdietrich

@cdietrich
Copy link
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants