Private modules are ordinary npm packages that only you, and people you select, can view, install, and publish. You publish them in your namespace or your team's namespace by giving them a name in package.json:
You publish them with npm publish
just like any other package, and you install
them by name:
npm install @myuser/mypackage
Once installed, use them by requiring them by name, just like any other package:
var mypackage = ;
npm and the registry make it easy to share small modules of useful code with the world. However, sometimes the code in your package is private, sensitive, or just too specific to your needs for you to want to publish it to the public registry. Private packages allow you to share your code with a specific set of users, rather than the registry as a whole.
Whether you work in a team or you work for clients, you want to be able to privately share your work using the dependency management and version management that npm provides. By allowing you to control who can see, install and publish packages, private packages make this easy.
Last modified February 13, 2023 Found a typo? Send a pull request!