Examples (8)
Publish the current package to the default npm registry
Publish a package from a specific directory
npm publish path/to/package_directoryPublish a scoped package with public access
npm publish --access publicPublish a scoped package with restricted (private) access
npm publish --access restrictedPublish a package to a custom registry
npm publish --registry https://registry.npmjs.org/Run a dry run to see what would be published without uploading
npm publish --dry-runPublish a package with a specific distribution tag (e.g., beta)
npm publish --tag betaPublish with a one-time password for 2FA-enabled accounts
npm publish --otp one_time_passwordmade by @shridhargupta | data from tldr-pages