Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-50920

NPM registry credentials not correctly formatted

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not A Defect
    • Icon: Major Major
    • nodejs-plugin
    • None

      I am trying to use Jenkins to publish npm packages to a private npm repository.  I use the config-file-provider plugin to create a new npm config file.

      Creating the config looks like this:

      The credentials used in that config is a "username with password" credentials configured with the correct username/password for publishing to my repository.

       

      The publish part of my Jenkinsfile looks like:

      nodejs(nodeJSInstallationName: "6.12.0", configId: "npm-publish-config") {
          lerna publish --conventional-commits --yes
      }
      

       

      When I run the build I get the following error when it tries to publish: 

      need auth You need to authorize this machine using `npm adduser`

       

      I did a little debugging.  I was able to find the file it claims to have used as it's npm config:

      @myScope:registry = http://my.private.registry/
       //my.private.registry/:always-auth = true
       //my.private.registry/:username = jenkins
       //my.private.registry/:_password = <<redacted>>

      I have found no information online about the :username and :_password properties being supported by NPM.  Everything I have found has said that the .npmrc config file should have an _authToken property like this:

      @myScope:registry = http://my.private.registry/
       //my.private.registry/:always-auth = true
       //my.private.registry/:_authToken="SECRET"

      What am I doing wrong?

            nfalco Nikolas Falco
            johnmcase John Case
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: