Fixing npm WARN: No description message

Posted on May 19, 2022

Learn how to resolve npm WARN: No description message in your JavaScript project

When installing modules using npm, you may see a WARN message in the console that says “No description.”

The following is an example of the message when I add grunt to my project:

$ npm install grunt   
npm WARN r-app@1.0.0 No description

+ grunt@1.5.3
updated 1 package and audited 103 packages in 2.419s
found 0 vulnerabilities

The WARN message is just a warning check that you receive from npm.

Since r-app is the name of my JavaScript project, it means that the package.json file of my project doesn’t have a description property.

When you receive the same warning, add a description property to your package.json file as shown below:

{
  "name": "r-app",
  "version": "1.0.0",
  "description": "My test application",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "grunt": "^1.5.3"
  }
}

Note that you need to add something other than an empty string to make the warning go away.

The description property is used to add a brief description of your project. Alternatively, you can also set your project as private to suppress the error:

{
  "name": "r-app",
  "version": "1.0.0",
  "private": true,
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "grunt": "^1.5.3"
  }
}

With the private property set to true, npm won’t complain about the lack of the description property.

Sometimes, the warning can also appear from the package you install:

npm WARN package.json b-app@0.1.0 No description
npm WARN package.json c-app@0.1.0 No description

In this case, you can try to reach out to the package maintainers and let them know about the warning.

But don’t worry because you can still use the package just fine. The description property doesn’t have any effect on the program itself.

Level up your programming skills

I'm sending out an occasional email with the latest programming tutorials. Drop your email in the box below and I'll send new stuff straight into your inbox!

No spam. Unsubscribe anytime.