What should I put in the license field of package.json if my code is only for use by the company I work for?

node.jspackage.json

node.js Problem Overview


NPM 2.11.3

I'm building a library in Node. This library is only for use by the company I am currently working for. I think this means that the license is "None". But when I npm init it wants me to use an SPDX License. "None" or "Unlicensed" are not valid options.

npm WARN package.json [email protected] license should be a valid SPDX license expression

There is some discussion around this on the NPM GitHub issue tracker but I can't find anything that definitively answers this. Perhaps NPM doesn't support this concept, but that seems odd.

What should I put for this field in this case? I'd like to get rid of the npm warnings related to this.

While the docs say that UNLICENSED is valid, it still gives a warning:

$ cat package.json | grep licen
  "license": "UNLICENSED",

$ npm install 
npm WARN package.json data_monitoring_api@0.1.0 license should be a valid SPDX license expression

node.js Solutions


Solution 1 - node.js

Use UNLICENSED per the npm docs:

> Finally, if you do not wish to grant others the right to use a private or unpublished package under any terms: >

{
  "license": "UNLICENSED"
}

This is not to be confused with the license that was confusingly called "The Unlicense".

Solution 2 - node.js

> at the time of writing UNLICENSED (see the code sample in the > question) was not an option please see jcollum's answer

Adding private to package.json will help:

"private": true

Solution 3 - node.js

On the second column of the table found on this link, https://spdx.org/licenses/, you can see all the different SPDX format to used in your package.json.

The name of the column is Identifier just in case. Thanks and hope it helps.

Solution 4 - node.js

For me whatever license I put in the code did not work. But then I figured out, that there is a invalid package.json in the parent directory. After removing it, this solved all the issues.

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
QuestionjcollumView Question on Stackoverflow
Solution 1 - node.jsjcollumView Answer on Stackoverflow
Solution 2 - node.jsKieranView Answer on Stackoverflow
Solution 3 - node.jsDerick AlangiView Answer on Stackoverflow
Solution 4 - node.jsbuksoView Answer on Stackoverflow