npm private registry — configure .npmrc for authentication

# .npmrc in project root
registry=https://registry.npmjs.org/

# Scope-specific registry
@myorg:registry=https://npm.pkg.github.com/

# Auth token for private registry
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}

Your project uses packages from a private registry or GitHub Packages.

GitHub Packages setup

# .npmrc
@myorg:registry=https://npm.pkg.github.com/
//npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}

# Authenticate via npm login
npm login --registry=https://npm.pkg.github.com/ --scope=@myorg

Set registry temporarily

# One-time install from a specific registry
npm install @myorg/lib --registry=https://npm.pkg.github.com/

# Set globally
npm config set registry https://registry.npmjs.org/

Store token securely

# WRONG — do not commit the token
//npm.pkg.github.com/:_authToken=ghp_actualtoken123

# CORRECT — use environment variable
//npm.pkg.github.com/:_authToken=${NPM_TOKEN}

# Set NPM_TOKEN in CI environment variables or .env (not committed)