NPM - How to fix “No readme data”

2019-03-07 22:10发布

问题:

I have a simple package.json:

{
  "name": "camapaign",
  "version": "0.0.1",
  "scripts": {
    "start": "node app.js"
  },
  "engines": {
    "node": "0.10.15",
    "npm": "1.3.5"
  },
  "repository": { 
    "type": "svn",
    "url": ""
  }
}

When I execute "npm install" i get the following warning which I would like to fix:

"npm WARN package.json camapaign@0.0.1 No readme data."

I have tried adding "README.md" & "readme.txt" to the same dir as the package but with no joy. What am I missing?

回答1:

Simply adding a README.md file will not fix it, you should write something inside it; at least the project title and a brief description is good for people! But for NPM, one byte may be enough...
Doing so should stop showing the warnings.

Also, when you read that warning, ensure that the problem is not related to a 3rd party package.



回答2:

Just set as private ;)

{
  "name": "camapaign",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "start": "node app.js"
  },
  "engines": {
    "node": "0.10.15",
    "npm": "1.3.5"
  },
  "repository": { 
    "type": "svn",
    "url": ""
  }
}


回答3:

Adding a README.md to your project root is the answer, but I've noticed that it takes a short while for NPM to pick up on this. Maybe a few minutes?



回答4:

Add to package.json "readme": "README.md"



回答5:

As of today, Apr 2017, just setting below in package.json, still works fine:

"private": true

this means its your private repository

even, with latest npm, it works fine:

npm update -g npm
> 3.10.8


标签: npm