I want to globally setup an NPM registry for a specific scope to be used with a specific token.
I know that I can use :
$ npm login --scope=@organisation
And I can also write a ~/.npmrc
with :
//registry.npmjs.org/:_authToken=XXXX
But what I want is a combinaison of the two methods: Using the token at when assigning the registry URL to my scope.
I tried :
npm config set @organisation:registry https://registry.npmjs.org/:_authToken=XXXX
But when running an NPM command (eg npm install @organisation/my-package
). I get the following error :
npm ERR! Darwin 15.6.0
npm ERR! argv "/Users/me/.nvm/versions/node/v6.2.2/bin/node" "/Users/me/.nvm/versions/node/v6.2.2/bin/npm" "install" "@organisation/my-package"
npm ERR! node v6.2.2
npm ERR! npm v3.10.3
npm ERR! code E403
npm ERR! you do not have permission to publish ":_authToken=XXXX". Are you logged in as the correct user? : :_authToken=XXXX
Is there a solution? (I need to use a token and no env variable).
PS: https://github.com/npm/npm/issues/7995#issuecomment-175915766 but it's not working...