Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
337 views
in Technique[技术] by (71.8m points)

node.js - npm WARN package.json:没有存储库字段(npm WARN package.json: No repository field)

I installed Express.js with the following command:

(我使用以下命令安装了Express.js:)

sudo npm install -g express

I get the following warnings:

(我收到以下警告:)

npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No readme data.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] No repository field.

I'm new to Node.js and Express.js.

(我是Node.js和Express.js的新手。)

Why do I have the above warnings?

(为什么我有上述警告?)

Should I be worried?

(我应该担心吗?)

  ask by JR Galia translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

It's just a check as of NPM v1.2.20, they report this as a warning.

(这只是NPM v1.2.20的检查,他们将此报告为警告。)

However, don't worry, there are sooooooo many packages which still don't have the repository field in their package.json .

(不过,不用担心,有仍然没有sooooooo许多包repository在自己的领域package.json 。)

The field is used for informational purposes.

(该字段用于提供信息。)

In the case you're a package author, put the repository in your package.json , like this:

(如果您是包作者,请将repository放在package.json ,如下所示:)

"repository": {
  "type": "git",
  "url": "git://github.com/username/repository.git"
}

Read more about the repository field, and see the logged bug for further details.

(阅读有关repository字段的更多repository ,并查看记录的错误以获取更多详细信息)


Additionally, as originally reported by @dan_nl , you can set private key in your package.json .

(此外, 正如@dan_nl最初报告的那样 ,您可以在package.json设置private 。)
This will not only stop you from accidentally running npm publish in your app, but will also stop NPM from printing warnings regarding package.json problems.

(这不仅会阻止您在应用程序中意外运行npm publish ,还会阻止NPM打印有关package.json问题的警告。)

{
  "name": "my-super-amazing-app",
  "version": "1.0.0",
  "private": true
}

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...