我希望我的 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 must be actual JSON, not just 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"
}
}
最佳答案
您的 package.json 中似乎有错误。 C:\Users\zm2759\AppData\Roaming\npm-cache\wordwrap\0.0.2\package\package.json
中的一个。由于它在 npm-cache 中,我相信您可以使用 npm cache clean
清除它。
不然你自己的package.json
好像没有问题。
关于Windows 给出 package.json 文件错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19743779/