为什么在您的package.json中将“ private”设置为true时,“ 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

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,
  ...
}

Now, all warnings related to No license field disappeared. Why?

评论
  • 尔如此冷淡
    尔如此冷淡 回复

    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.

    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.