srs/gradle-node-plugin

NodeJS cannot be resolved (Gradle 6)

dpeger opened this issue · 15 comments

With the upcoming Gradle 6.0 release it looks like resolving of the NodeJS artifact needs to be reworked. With the latest nightly (6.0-20191008230708+0000) I'm getting this error for the nodeSetup task:

Execution failed for task ':project:nodeSetup'.
> Could not resolve all files for configuration ':project: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 :project
deepy commented

This is one of the reasons why we created the fork node-gradle/gradle-node-plugin#2

@deepy thanks for replying.

I saw that issue (#299), but as it mentioned Gradle 5 I did not further look into the details. So it seems it's actually broken with Gradle 6...

I currently need the gulp plugin as well. So switching to node-gradle will not work out-of-the-box. But I can probably graft your fix!

deepy commented

The gulp plugin consists of an npm install gulp and a Node Task pointing to the node_modules/bin/gulp.js

Personally I think you'd be better off using the newly introduced NpxTask for gulp rather than GulpTask.

The fork is in active development so if it's incompatible with Gradle 6 we'll fix that

Since I want to get rid of gulp anyway this might be a good reason to tackle this and use your fork afterwards...

is there any update on this? We cannot upgrade to Gradle 6 because of this...

@huehnerlady Just switch to https://github.com/node-gradle/gradle-node-plugin

It's a drop-in replacement.

Is there a way to configure name of the zip to look for from distBaseUrl. I am currently giving distBaseUrl as my local filesystem it works but it looks node zip in specific format like win64-nodejs.zip is this search name configurable.

For anyone else who ends up here and are like me. For Pete's sake, make sure to remove whitespace around your version tag!

@worldsayshi

For anyone else who ends up here and are like me. For Pete's sake, make sure to remove whitespace around your version tag!

Please demonstrate?
I'm using like this

node {
    version = 'v12.18.4'
}
deepy commented

I'm pretty sure we solved this a long time ago in the fork

deepy commented

Well it's working flawlessly in our examples, so maybe you can create a small repository showing the issue and posting it in the fork's issues?

Hi,

I'm also facing the same issue when I tried with gradle 6.6.1 and node plugin 1.3.1.

Is there any temporary solution or any new version coming up ?

Thanks,
Sudheer.

@ateebahmed My issue doesn't seem relevant for your issue. I loaded my version number from an external file. I don't have the code available right now, so this is pseudo code:

node {
    version = loadTextFromFile('.npmrc')
}

The issue was that my editor, Intellij, added a newline at the end of the .npmrc file whenever I saved it. I solved it by removing surrounding white space after loading the text from file.

@worldsayshi

For anyone else who ends up here and are like me. For Pete's sake, make sure to remove whitespace around your version tag!

Please demonstrate?
I'm using like this

node {
    version = 'v12.18.4'
}

remove v
node { version = '12.18.4' }