Publishing Packages in NPM

From the NPM Package Manager cheat sheet ยท Publishing & Versioning ยท verified Jul 2026

Publishing Packages

Publish to NPM registry

bash
# Login to registry
npm login
npm whoami  # Verify login

# Publish package
npm publish

# Publish with tag
npm publish --tag beta
npm publish --tag next

# Publish scoped package publicly
npm publish --access public

# Dry run (see what would publish)
npm publish --dry-run

# Pack for inspection
npm pack  # Creates .tgz file
๐ŸŸข Essential for package authors
๐Ÿ’ก Use --dry-run to preview before publishing
โš ๏ธ Unpublish only works within 72 hours
๐Ÿ“Œ Use "files" field to control published files
๐Ÿ”— Related: np package for easier publishing
publishregistry

Continue with NPM Package Manager

Save the full cheat sheet or work through every related task.

More NPM tasks

Back to the full NPM Package Manager cheat sheet