为什么“无许可证字段"当您在 package.json 中设置 "private": true 时警告消失 [英] Why does "No license field" Warning Disappear when you set "private": true in your package.json
问题描述
我有一个 React 应用程序,它通过 yarn install
安装它的依赖项.当我运行此命令时,我收到以下 No license field
相关警告.
I have a react application that installs its dependencies via yarn install
. When I run this command, I get the following No license field
related warnings.
warning package.json: No license field
warning react-material-dashboard@0.3.0: No license field
然后我更新了 package.json
文件的 private
属性为 true
.(请参阅 NPM 文档)
Then I updated, the package.json
file's private
property to be true
. (See NPM docs)
{
"name": "some-application-name",
"author": "Keet Sugathadasa",
"email": "email",
"license": "MIT",
"version": "0.0.1",
"private": true,
...
}
现在,与No license field
相关的所有警告都消失了.为什么?
Now, all warnings related to No license field
disappeared. Why?
推荐答案
警告抱怨没有 license
字段(带有 s
),但是你有有一个 licence
字段(带有 c
),更正拼写,警告就会消失.
The warning complains about there not being a license
field (with an s
), you do however have a licence
field (with a c
), correct the spelling and the warning should disappear.
设置 "private": true
起作用并防止出现警告的原因是私有包不会被分发,因此不需要许可证.
The reason that setting "private": true
works and prevents the warning from appearing is that private packages don't get distibuted and therefore do not need a license.
这篇关于为什么“无许可证字段"当您在 package.json 中设置 "private": true 时警告消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!