Supported Commands
The following commands are supported by the npm package registry:
npm install
This command is used to install dependencies listed in the package.json file.
- Open your terminal or command prompt.
- Navigate to your project directory.
Run the command:
npm install.
npm ci
This command is similar to npm install, but it’s designed for continuous integration environments to install dependencies more quickly and more consistently.
- Open your terminal or command prompt.
- Navigate to your project directory.
Run the command:
npm ci
npm publish
This command is used to publish a package to the npm registry.
- Make sure you have a package.json file in your project directory.
- Ensure your package has a unique name that hasn’t been used before on npm.
Run the command:
npm publish
npm unpublish
This command is used to unpublish a package from the npm registry.
- Navigate to your package’s directory.
Run the command:
npm unpublish <package_name>@<version>
npm dist-tag
This command allows you to add, remove, or modify distribution tags for a given package.
Run the command:
npm dist-tag add <package_name>@<version> <tag>
to add a tag to a specific version of a package.
Run the command:
npm dist-tag rm <package_name> <tag>
to remove a tag from a package.
Run the command:
npm dist-tag ls <package_name>
to list all tags for a package.
npm view
This command is used to view registry info about a package, version, or user.
Run the command:
npm view <package_name>
to view information about a package.
Run the command:
npm view <package_name>
versions to view all versions of a package.
Run the command:
npm view <package_name>
dependencies to view dependencies of a package.
npm search
This command is used to search for packages in the npm registry.
Run the command:
npm search <keyword>
to search for packages containing the specified keyword.
How to Publish NPM Packages in the Package Registry ?
The npm Package Registry serves as an invaluable tool for publishing npm packages for individual developers or organizations.
This article will guide you through the requirements, configuration, and usage of the npm package registry.
Table of Content
- Setting Up the Package Registry
- Publishing a Package
- Authenticating via the .npmrc
- Publishing a package via the command line
- Publishing a package by using a CI/CD pipeline
- Unpublishing a Package
- Installing a Package
- Tagging a Package
- Searching Packages
- Supported Commands
- Conclusion
Contact Us