3

我希望我的 Package.json 是这样的

{
  "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"
  }
}

我试过这个,npm install但得到了这个错误

package.json 必须是实际的 JSON,而不仅仅是 JavaScript。

所以我使用命令行来创建json,并添加依赖项。我发现大多数软件包都安装时没有出现此错误,而且我的 package.json 也通过使用npm install grunt-contrib-watch --save-dev等正确更新。

在 Windows 上,我只在两个包中看到此错误:对于 grunt-contrib-uglify" 以及 grunt-contrib-handlebars。所以我的 JSON 文件以

{
  "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"
  }
}
4

1 回答 1

5

似乎您的 package.json 中有错误。中的那个C:\Users\zm2759\AppData\Roaming\npm-cache\wordwrap\0.0.2\package\package.json。因为它在 npm-cache 里面,我相信你可以用npm cache clean.

否则你自己的似乎没有问题package.json

于 2013-11-03T05:23:17.930 回答