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

node.jspackage.json

node.js Problem Overview


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

node.js Solutions


Solution 1 - node.js

From the NPM docs on package.json:

> private > > 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.

Solution 2 - node.js

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

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionCarlLeeView Question on Stackoverflow
Solution 1 - node.jsaceView Answer on Stackoverflow
Solution 2 - node.jsRoman MotovilovView Answer on Stackoverflow