Set Up and Use Private npm Registries
Configure and publish to private npm registries using Verdaccio, GitHub Packages, or npm Teams for internal package distribution.
Prerequisites
- -Node.js and npm installed
- -Docker installed (for Verdaccio option)
- -npm account or GitHub account
Steps
Run a local Verdaccio registry
Start a self-hosted npm registry for development and testing.
Verdaccio proxies the public npm registry by default, so you can install public packages through it while hosting private ones.
Configure npm to use the private registry
Set the registry URL for a specific scope.
Scope-based registry config lets you use a private registry for @myorg/* packages while everything else goes to the public registry.
Authenticate with the private registry
Login to the private registry to publish and install private packages.
Publish to the private registry
Push a package to your private registry.
Configure .npmrc for the project
Create a project-level .npmrc to share registry config with the team.
Never commit auth tokens to .npmrc. Use environment variables and add .npmrc to .gitignore if it contains secrets. Use a .npmrc template checked into git with token placeholders.
Configure GitHub Packages as an alternative
Use GitHub Packages as a private registry for your organization.
Full Script
FAQ
Discussion
Loading comments...