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

can't find nodeJS 10.15.3 ? #368

Open
ptrtht opened this issue Mar 9, 2020 · 14 comments
Open

can't find nodeJS 10.15.3 ? #368

ptrtht opened this issue Mar 9, 2020 · 14 comments

Comments

@ptrtht
Copy link

ptrtht commented Mar 9, 2020

I started a new gradle app, in which I want to do reactjs FE.
I am unable to run my build due to the following error:

* What went wrong:
Execution failed for task ':nodeSetup'.
> Could not resolve all files for configuration ':detachedConfiguration1'.
   > Could not find org.nodejs:node:10.15.3.
     Searched in the following locations:
       - https://nodejs.org/dist/v10.15.3/ivy.xml
     Required by:
         project :

My build.gradle looks like this:


plugins {
	id 'org.springframework.boot' version '2.2.5.RELEASE'
	id 'io.spring.dependency-management' version '1.0.9.RELEASE'
	id 'java'
	id "com.moowork.node" version "1.3.1"
}

group = 'com.traveling.owl'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'

repositories {
	mavenCentral()
}

node {
	download = true
	workDir = file("${project.projectDir}/src/main/reactjs/nodejs")
	npmWorkDir = file("${project.projectDir}/src/main/reactjs/npm")
	nodeModulesDir = file("${project.projectDir}/src/main/reactjs")
}

task npmInstallDependencies(type: NpmTask) {
	dependsOn 'npmSetup'
	execOverrides {
		it.ignoreExitValue = true
		it.workingDir = 'src/main/reactjs'
	}
	args = ['install']
}

task npmBuild(type: NpmTask) {
	dependsOn 'npmInstallDependencies'
	execOverrides {
		it.workingDir = 'src/main/reactjs'
	}
	args = ['run', 'build']
}

task copyBuild(type: Copy) {
	dependsOn 'npmBuild'
	from "$projectDir/src/main/reactjs/build"
	into "$buildDir/src/main/resources/static"
}

processResources {
	dependsOn 'copyBuild'
}

dependencies {
	implementation 'org.springframework.boot:spring-boot-starter-data-rest'
	implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
	implementation 'org.springframework.boot:spring-boot-starter-web'
	testImplementation('org.springframework.boot:spring-boot-starter-test') {
		exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
	}
}

test {
	useJUnitPlatform()
}

I only have nodejs v10.15.3 installed.
What can be the problem in my case?

@ptrtht ptrtht changed the title can't find or.nodejs can't find nodeJS 10.15.3 ? Mar 9, 2020
@kosmoflyko
Copy link

@qty0 I have similar issue for any node version with this plugin now. I see that this plugin no supported now, but many documents has link to this plugin. As workaround you can use new version https://github.com/node-gradle/gradle-node-plugin/blob/master/docs/node.md

@gunslingor
Copy link

gunslingor commented Mar 24, 2020

I'm having lots of similar issues for days now. it has something to do with mooworks conflicts I think., or kotlinNodeJsSetup or resources folders. No matter what I do I can't get jsBrowserTests to run with my stuff. But everything else runs fine. Days wasted on this, discussion link in slack might work for details of troubleshooting:

https://kotlinlang.slack.com/archives/C3PQML5NU/p1585030653200800

@deepy
Copy link

deepy commented Mar 24, 2020

I'm having lots of similar issues for days now. it has something to do with mooworks conflicts I think., or kotlinNodeJsSetup or resources folders. No matter what I do I can't get jsBrowserTests to run with my stuff. But everything else runs fine. Days wasted on this, discussion link in slack might work for details of troubleshooting:

Either you'll have to downgrade Gradle far back or switch to a fork.

@gunslingor
Copy link

gunslingor commented Mar 27, 2020

For me, problem was solved in the slack thread I posted above. How or why this solved it I do not know exactly, but it feels like its directly injecting my js dependancy into karma thru webpack.config external file or something like that.

The solution was to create a folder and file on the root directory called karma.config.d/config.js with the following in it:
config.files.unshift(require('path').resolve(__dirname, "../../../processedResources/frontend/main/libs/js/[YOUR JS FILE NAME].min.js"));

Not a fan of having this extra config on the root level and personally I don't understand what this TRUELY is or why I can't configure it from gradle multiplatform... I mean a goal of gradle is to be able to configure everything with it right?

@thomasmhofmann
Copy link

I think this is related to changes in Gradle 6: https://docs.gradle.org/current/userguide/declaring_repositories.html#sec:supported_metadata_sources

It is looking for an ivy.xml file that is not published / available.

@thomasmhofmann
Copy link

This would probably need to change here:

this.repo = this.project.repositories.ivy {

metadataSources {
ivyDesriptor()
artifact()
}

@thomasmhofmann
Copy link

Actually this seems already to be know: #349 (comment)

@deepy
Copy link

deepy commented May 8, 2020

There's an actively maintained fork at https://github.com/node-gradle/gradle-node-plugin
But we've dropped the grunt/gulp support in favor of npx

@thomasmhofmann
Copy link

Thanks I already switched to that fork. I wasn't aware this not longer being maintained. Your fork works good with Gradle 6 so thanks a lot.

@Jensen-Mourat
Copy link

Added a fork with the fix for those using earlier gradle versions (Tested with gradle 2.11).

https://github.com/Jensen-Mourat/gradle-node-plugin

@deepy
Copy link

deepy commented Aug 23, 2021

If you're still on gradle 2 you have great incentives to upgrade, it's a pretty painless process and gradle gets much faster

@Jensen-Mourat
Copy link

Jensen-Mourat commented Aug 23, 2021

@deepy I would love to upgrade but for some reasons the monolith of a framework we are using supports only gradle 2.11. Sadly not everyone gets to use the new and shiny version of a program :(

@deepy
Copy link

deepy commented Aug 23, 2021

That kinda makes me curious about your fork as this issue comes with gradle 4 or 3

@Jensen-Mourat
Copy link

I bypassed the way node js was meant to be downloaded using gradle here:

 this.repo = this.project.repositories.ivy {
            url distUrl
            layout 'pattern', {
                artifact 'v[revision]/[artifact](-v[revision]-[classifier]).[ext]'
                ivy 'v[revision]/ivy.xml'
            }
        }

and simply wrote some download logic which gets the correct node version respective of the os and arc

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

6 participants