private npm package

; bad config
_authToken=MYTOKEN

; good config
@myorg:registry=https://somewhere-else.com/myorg
@another:registry=https://somewhere-else.com/another
//registry.npmjs.org/:_authToken=MYTOKEN
; would apply to both @myorg and @another
; //somewhere-else.com/:_authToken=MYTOKEN
; would apply only to @myorg
//somewhere-else.com/myorg/:_authToken=MYTOKEN1
; would apply only to @another
//somewhere-else.com/another/:_authToken=MYTOKEN2

example .npmrc when use github

//npm.pkg.github.com/:_authToken=${GITHUB_PERSONAL_ACCESS_TOKEN}
@${ORGANIZATION_NAME}:registry=https://npm.pkg.github.com/

Tips

if you want to apply only specific project, then put .npmrc on your project root

if you want to apply this configuration as global, then put .npmrc under ~/ as know as /Users/${USER_SPACE}

if you set your ~/.npmrc

Last updated

Was this helpful?