I installed Express.js with the following command:
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. Why do I have the above warnings? Should I be worried?
Have you run npm init
? That command runs you through everything...
To avoid warnings like:
npm WARN [email protected] 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
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.
Yes, probably you can re/create one by including -f
at the end of your command
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
}
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
}
use
npm install -g angular-cli
instead of
npm install -g@nagular/cli
to install Angular
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"
}
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 :)
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
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"
}
Source: Stackoverflow.com