How to build npmrc with auth that works on npm 3.x, 4.x, 5.x and yarn

I am setting up jenkins node to build all my node.js apps and the company has many node.js apps using node / npm version. I am trying to set up ~/.npmrc

that works for npm> = 3.x and yarn.

Below the ~/.npmrc

wheel works for npm

3.x / 4.x or yarn

:

registry=http://nexus.my.domain/repository/npm-all-group/
always-auth=true
email=my@domain.email
_auth="Base64Of(login:password)"
strict-ssl=false

      

And below ~/.npmrc

only works on npm 5.x

:

//nexus.my.domain/repository/npm-all-group/:_authToken=secrete-token-create-using-login-and-password

      

If I join a booth, I always get the error:

npm ERR! code E401
npm ERR! 401 Unauthorized: coffee-script@1.7.1

      

Can I create a file ~/.npmrc

that works for all versions? I am using sonatype nexus 3.3.2 as npm server.

+3


source to share





All Articles