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

NPM registry credentials not correctly formatted

    XMLWordPrintable

    Details

    • Similar Issues:

      Description

      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?

        Attachments

          Activity

          johnmcase John Case created issue -
          johnmcase John Case made changes -
          Field Original Value New Value
          Description 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:

          !npmConfig.PNG!

          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:
          {code:java}
          nodejs(nodeJSInstallationName: "6.12.0", configId: "npm-publish-config") {
              lerna publish --conventional-commits --yes
          }
          {code}
           

          When I run the build I get the following error when it tries to publish: 
          {noformat}
          need auth You need to authorize this machine using `npm adduser`{noformat}
           

          I did a little debugging.  I was able to fine the file it claims to have used as it's npm config:
          {code:java}
          @myScope:registry = http://my.private.registry/
           //my.private.registry/:always-auth = true
           //my.private.registry/:username = jenkins
           //my.private.registry/:_password = <<redacted>>{code}
          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:
          {code:java}
          @myScope:registry = http://my.private.registry/
           //my.private.registry/:always-auth = true
           //my.private.registry/:_authToken="SECRET"{code}
          What am I doing wrong?
          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:

          !npmConfig.PNG!

          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:
          {code:java}
          nodejs(nodeJSInstallationName: "6.12.0", configId: "npm-publish-config") {
              lerna publish --conventional-commits --yes
          }
          {code}
           

          When I run the build I get the following error when it tries to publish: 
          {noformat}
          need auth You need to authorize this machine using `npm adduser`{noformat}
           

          I did a little debugging.  I was able to find the file it claims to have used as it's npm config:
          {code:java}
          @myScope:registry = http://my.private.registry/
           //my.private.registry/:always-auth = true
           //my.private.registry/:username = jenkins
           //my.private.registry/:_password = <<redacted>>{code}
          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:
          {code:java}
          @myScope:registry = http://my.private.registry/
           //my.private.registry/:always-auth = true
           //my.private.registry/:_authToken="SECRET"{code}
          What am I doing wrong?
          imod Dominik Bartholdi made changes -
          Component/s config-file-provider-plugin [ 16140 ]
          imod Dominik Bartholdi made changes -
          Assignee Dominik Bartholdi [ domi ] Nikolas Falco [ nfalco ]
          nfalco Nikolas Falco made changes -
          Resolution Not A Defect [ 7 ]
          Status Open [ 1 ] Closed [ 6 ]

            People

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

              Dates

              Created:
              Updated:
              Resolved: