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

Getting authentication error while downloading node distribution from company artficatory #66

Open
kkatleri opened this issue Feb 8, 2020 · 3 comments
Labels
workaround exists There is a workaround for this already

Comments

@kkatleri
Copy link

kkatleri commented Feb 8, 2020

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.

@deepy
Copy link
Member

deepy commented Feb 10, 2020

In this case you want to use distBaseUrl = null and manually add an ivy repo with authentication

Something like

repositories.ivy {
    setUrl('https://foo')
    credentials {
         username "me"
         password "hunter2"
    }
    patternLayout {
        artifact("[artifact](-v[revision]-[classifier]).[ext]")
    }
    metadataSources {
        artifact()
    }
}

node {
    distBaseUrl = null
}

@deepy deepy added the workaround exists There is a workaround for this already label Feb 10, 2020
@deepy
Copy link
Member

deepy commented Feb 10, 2020

I should've added this to the documentation earlier but I forgot

@kkatleri
Copy link
Author

Thank you @deepy for your response. I am now able to get to artifactory node distribution with your solution. Thanks a lot!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
workaround exists There is a workaround for this already
Projects
None yet
Development

No branches or pull requests

2 participants