'What is purpose of the property "private" in package.json?

I'm learning node.js and express, I am wondering what is the property "private" in ./package.json file used for?



Solution 1:[1]

If you set "private": true in your package.json, then npm will refuse to publish it.

This is a way to prevent accidental publication of private repositories. If you would like to ensure that a given package is only ever published to a specific registry (for example, an internal registry), then use the publishConfig dictionary described below to override the registry config param at publish-time.

Also, you can read extra information in the documentation. Please find the link below.

https://docs.npmjs.com/cli/v7/configuring-npm/package-json#private

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Roman Motovilov