Default registry
Bun uses npm’s public registry by default:Custom registry
Global registry
Set a custom registry for all packages:Via bunfig.toml
Via environment variable
Via .npmrc
Bun respects.npmrc files:
Scoped registries
Use different registries for scoped packages:.npmrc:
Authentication
Token authentication
Via bunfig.toml
Via .npmrc
Basic authentication
URL with credentials
Popular registries
npm (default)
GitHub Packages
.npmrc:
GitLab Packages
.npmrc:
Azure Artifacts
JFrog Artifactory
Verdaccio (private registry)
Nexus Repository
Environment-specific registries
Development vs Production
Registry mirrors
Use faster mirrors:.npmrc locations
Bun reads.npmrc in this order:
- Project -
./ - User -
~/.npmrc - Global -
/etc/npmrc
Per-project
Per-user
Global
Troubleshooting
Test registry connection
Verify authentication
Clear registry cache
Debug registry requests
Certificate errors
For self-signed certificates:Proxy configuration
CI/CD
GitHub Actions
GitLab CI
Docker
Best practices
Don’t commit tokens
Use environment variables:.npmrc to .gitignore if it contains secrets: