Search code examples
node.jspackage.jsonspdx

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


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 data_monitoring_api@0.1.0 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

Solution

  • 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".