node.js 如果我的代码仅供我工作的公司使用,那么在 package.json 的 license 字段中应该放什么?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/32214751/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 19:16:16  来源:igfitidea点击:

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

node.jspackage.json

提问by jcollum

NPM 2.11.3

新产品管理 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 initit wants me to use an SPDX License. "None" or "Unlicensed" are not valid options.

我正在 Node.js 中构建一个库。该库仅供我目前工作的公司使用。我认为这意味着许可证是“无”。但是当我npm init想要我使用 SPDX 许可证时。“无”或“未经许可”不是有效选项。

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

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.

在 NPM GitHub 问题跟踪器上对此进行了一些讨论,但我找不到任何可以明确回答此问题的内容。也许 NPM 不支持这个概念,但这似乎很奇怪。

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

在这种情况下,我应该为这个字段输入什么?我想摆脱与此相关的 npm 警告。

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

虽然文档说 UNLICENSED 是有效的,但它仍然给出警告:

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

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

采纳答案by jcollum

UNLICENSEDis now a valid license option in npm.This is not the same as "The Unlicense".

UNLICENSED现在是 npm 中的有效许可选项。这与“未经许可”不同。

回答by Kieran

at the time of writing UNLICENSED (see the code sample in the question) was not an option please see jcollumns answer

在编写 UNLICENSED 时(请参阅问题中的代码示例)不是一个选项,请参阅jcollumns 答案

Adding privateto package.jsonwill help:

添加privatepackage.json将有助于:

"private": true

回答by Derick Alangi

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.

在此链接上的表格的第二列https://spdx.org/licenses/ 中,您可以看到在您的package.json.

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

列的名称Identifier只是为了以防万一。谢谢并希望它有所帮助。