node-gradle / node-gradle/gradle-node-plugin

Getting authentication error while downloading node distribution from company artficatory

Open
#66 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

workaround exists
Dominant language
Groovy
Stars
677
Forks
120
PR merge metrics
No merged PRs in 30d

Description

I tried using below two node plugins in my gradle build -

`id "com.moowork.node" version "1.3.1" `

and

` id "com.github.node-gradle.node" version "2.2.1" `

and this is how my gradle file looks like -


      ```
 buildscript {
      repositories {
        maven{
          url "http://artifactory.xxx.xxxxx/artifactory/plugins-release"
          credentials {
            username = "${artifact_user}"
            password = "${artifact_password}"
          }
        }
      }
      dependencies {
        classpath "com.moowork.gradle:gradle-node-plugin:0.12"
      }
    } 
    apply plugin: "java"
        apply plugin: "com.moowork.node"
        node {
          version = '12.13.0'
          npmVersion = '6.12.0'
          distBaseUrl = 'http://username:password**@artifactory.xxx.xxxx/artifactory/node-repo/'
          download = true
          
        }

but when I run nodeSetup task using gradle nodeSetup command, getting below error -

> Could not resolve org.nodejs:node:12.13.0.
           > Could not get resource 'http://artifactory.xxxx.xxxxxxx/artifactory/node-repo/v12.13.0/node-v12.13.0-win-x64.zip'.
              > Could not HEAD 'http://artifactory..xxxx.xxxxxxx/artifactory/node-repo/v12.13.0/node-v12.13.0-win-x64.zip'. Received status code 401 from server: Unauthorized

I have verified the username and password. The same artifactory url with username]/password embedded in it works fine in the browser or postman, but getting authentication error in gradle build. Please advice.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the build.gradle node configuration and the gradle nodeSetup command shown in the report. Inspect how the plugin handles the authenticated distBaseUrl request, then reproduce the 401 response against the listed Artifactory URL. Done means nodeSetup can download node-v12.13.0-win-x64.zip successfully using the configured credentials.

Written by the indexing model from the issue text.

Assessment

Tech stack
groovy, node.js
Domain
authentication, build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.