My ~/.npmrc looks like
% cat ~/.npmrc
//npm.pkg.github.com/:_authToken=XXXXXXX
//npmjs.org=true
@1uphealth:registry=https://npm.pkg.github.com/1uphealth
In theory our packages like @1uphealth/foobar get installed from our private github packages repository and this works fine for npm
It seems to match the pnpm docs, here, https://pnpm.io/npmrc#url_authtoken, too.
But I am getting this error,
ERR_PNPM_FETCH_401 GET https://npm.pkg.github.com/1uphealth/@1uphealth%2Fcore-1upenv-script: Unauthorized - 401
No authorization header was set for the request.
These authorization settings were found:
//npm.pkg.github.com/:_authToken=[hidden]
@1uphealth:registry=https://npm.pkg.github.com/1uphealth
It seems like the problem is appending the owner to the registry url.
❌ Wrong
@1uphealth:registry=https://npm.pkg.github.com/1uphealth
✅ Correct
@1uphealth:registry=https://npm.pkg.github.com
✅ Full Working Example
# Use github package registry for @owner-co namespace
# Enables respective namespaces packages to pull from GitHub Packages Registry
@owner-co:registry=https://npm.pkg.github.com
# Enables accessing private GitHub Packages
# Token must have read:packages permission
# GitHub Tokens - https://github.com/settings/tokens
//npm.pkg.github.com/:_authToken=ghp_ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ
Source - https://github.com/pnpm/pnpm/issues/2933#issuecomment-975886322
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With