npm WARN package.json: No repository field

node.jsExpressNpm

node.js Problem Overview


I installed Express.js with the following command:

sudo npm install -g express

I get the following warnings:

npm WARN package.json range-parser@0.0.4 No repository field.
npm WARN package.json fresh@0.1.0 No repository field.
npm WARN package.json methods@0.0.1 No repository field.
npm WARN package.json methods@0.0.1 No readme data.
npm WARN package.json cookie-signature@1.0.1 No repository field.
npm WARN package.json send@0.1.0 No repository field.
npm WARN package.json pause@0.0.1 No repository field.
npm WARN package.json bytes@0.2.0 No repository field.
npm WARN package.json github-url-from-git@1.1.1 No repository field.
npm WARN package.json assert-plus@0.1.2 No repository field.
npm WARN package.json ctype@0.5.2 No repository field.

I'm new to Node.js and Express.js. Why do I have the above warnings? Should I be worried?

node.js Solutions


Solution 1 - node.js

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

However, don't worry, there are sooooooo many packages which still don't have the repository field in their 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": {
  "type": "git",
  "url": "git://github.com/username/repository.git"
}

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


Additionally, as originally reported by @dan_nl, you can set private key in your package.json.
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.

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

Solution 2 - node.js

you can also mark the application as private if you don’t plan to put it in an actual repository.

{
  "name": "my-application",
  "version": "0.0.1",
  "private": true
}

Solution 3 - node.js

As dan_nl stated, you can add a private fake repository in package.json. You don't even need name and version for it:

{
  ...,
  "repository": {
    "private": true
  }
}

Update: This feature is undocumented and might not work. Choose the following option.

Better still: Set the private flag directly. This way npm doesn't ask for a README file either:

{
  "name": ...,
  "description": ...,
  "version": ...,
  "private": true
}

Solution 4 - node.js

If you are getting this from your own package.json, just add the repository field to it. (use the link to your actual repository):

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

Solution 5 - node.js

Have you run npm init? That command runs you through everything...

Solution 6 - node.js

In Simple word- package.json of your project has not property of repository you must have to add it,

and you have to add repository in your package.json like below

enter image description here

and Let me explain according to your scenario

you must have to add repository field something like below

  "repository" : {     
     "type" : "git",
      "url" : "http://github.com/npm/express.git" 
   }

Solution 7 - node.js

If you don't want to specify a repository you can add the following lines to the package.json file:

"description":"",
"version":"0.0.1",
"private":true,

That worked for me.
By adding private, you don't need to link to a repo.

Solution 8 - node.js

To avoid warnings like:

npm WARN project.com@1.0.0 No repository field.

You must define repository in your project package.json. In the case when you are developing with no publishing to the repository you can set "private": true in package.json

Example:

{
  "name": "test.loc",
  "version": "1.0.0",
  "private": true,
  ...
  "license": "ISC"
}

NPM documentation about this: https://docs.npmjs.com/files/package.json

Solution 9 - node.js

Yes, probably you can re/create one by including -f at the end of your command

Solution 10 - node.js

this will help all of you to find your own correct details use

npm ls dist-tag

this will then show the correct info so you don't guess the version file location etc

enjoy :)

Solution 11 - node.js

use npm install -g angular-cli instead of
npm install -g@nagular/cli to install Angular

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJR GaliaView Question on Stackoverflow
Solution 1 - node.jsgustavohenkeView Answer on Stackoverflow
Solution 2 - node.jsdan_nlView Answer on Stackoverflow
Solution 3 - node.jswortwartView Answer on Stackoverflow
Solution 4 - node.jsBrendan NeeView Answer on Stackoverflow
Solution 5 - node.jsachoukahView Answer on Stackoverflow
Solution 6 - node.jsShashwat GuptaView Answer on Stackoverflow
Solution 7 - node.jsRubin bhandariView Answer on Stackoverflow
Solution 8 - node.jsAlexView Answer on Stackoverflow
Solution 9 - node.jsJsalimView Answer on Stackoverflow
Solution 10 - node.jsIan CroasdellView Answer on Stackoverflow
Solution 11 - node.jsAlnebras MurtadaView Answer on Stackoverflow