我希望我的 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"
}
}