Windows 给出 package.json 文件错误

标签 windows node.js gruntjs grunt-contrib-uglify

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

相关文章:

c++ - 使用 VC++ 在 Windows 上保护虚拟磁盘

javascript - 使用node.js获取数据

javascript - 使用 Fetch 将 JSON 放入文档正文中 - Javascript

node.js - OpenAI GPT-3 API 错误 : "That model does not exist"

javascript - Bower 安装命令在 Windows 上不起作用

angularjs - 我需要什么文件来托管 angularJS 网站

c++ - 通过 Gina 修改 Windows ctrl-alt-del 行为

c++ - Windows 上的直接文件系统函数调用

c++ - 无法在 Windows 上的 Qt Creator 中选择 GDB

javascript - 使用 grunt-shell 和 grunt-ssh 运行的 Grunt 同步任务