Windows gives error with package.json file

Problem

I wanted my Package.json to be something like this

{
  "name": "Billing",
  "version": "0.0.0",
  "dependencies": {
    "grunt": "~0.4.1",
    "grunt-contrib-watch": "~0.5.3",
    "grunt-contrib-compass": "~0.5.0",
    "grunt-contrib-uglify": "~0.2.2",
    "grunt-contrib-cssmin": "~0.6.2",
    "matchdep": "~0.1.2"
  },
  "devDependencies": {
    "grunt-contrib-handlebars": "~0.5.4",
    "grunt-contrib-less": "~0.8.1"
  }
}

I tried this using npm install but got this error

package.json must be actual JSON, not just JavaScript.

So I used command line to create json, and added dependencies. What I found was that most of the packages were installed without giving this errors, and also my package.json got updated correctly by using npm install grunt-contrib-watch --save-dev and so on.

On Windows I am seeing this error only for two packages: for grunt-contrib-uglify" as well as grunt-contrib-handlebars. So my JSON file is ending with

{
  "name": "Billing",
  "version": "0.0.0",
  "dependencies": {
    "grunt": "~0.4.1",
    "grunt-contrib-watch": "~0.5.3",
    "grunt-contrib-compass": "~0.5.0",
    "grunt-contrib-cssmin": "~0.6.2",
    "matchdep": "~0.1.2"
  },
  "devDependencies": {
    "grunt-contrib-less": "~0.8.1"
  }
}
Problem courtesy of: Zama Mohammed

Solution

Seems like there is an error in your package.json. The one in C:\Users\zm2759\AppData\Roaming\npm-cache\wordwrap\0.0.2\package\package.json. Since it is inside npm-cache, I believe you can clear it with npm cache clean.

Otherwise there seems to be no problem with your own package.json.

Solution courtesy of: user568109

Discussion

There is currently no discussion for this recipe.

This recipe can be found in it's original form on Stack Over Flow.