在向dev-dependencies添加grunt时无法解析json

 流血的云_-86097 发布于 2023-01-16 10:46

我有一个简单的package.json,我正在尝试将grunt添加到我的项目中.我已经多次这样做但从未遇到过这个问题

我的package.json:

{
  "name": "express-todo",
  "main": "server.js",
  "dependencies": {
    "body-parser": "^1.0.2",
    "express": "^4.1.1",
    "jade": "^1.3.1",
    "mongoose": "^3.8.8",
    "nodemon": "^1.0.17",
    "request": "^2.34.0"
  }
}

然后从命令行我得到错误:

$ npm install grunt --save-dev
npm WARN package.json express-todo@ No repository field.
npm http GET https://registry.npmjs.org/grunt
npm http 304 https://registry.npmjs.org/grunt
npm ERR! Failed to parse json
npm ERR! Unexpected end of input
npm ERR! File: /home/jasonshark/.npm/grunt/0.4.4/package/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR! 
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! System Linux 3.2.0-61-generic-pae
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "grunt" "--save-dev"
npm ERR! cwd /home/jasonshark/Projects/express-todo
npm ERR! node -v v0.10.28
npm ERR! npm -v 1.4.9
npm ERR! file /home/jasonshark/.npm/grunt/0.4.4/package/package.json
npm ERR! code EJSONPARSE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/jasonshark/Projects/express-todo/npm-debug.log
npm ERR! not ok code 0

Connor Leech.. 8

npm cache clean 就是我所需要的一切

撰写答案
今天,你开发时遇到什么问题呢?
立即提问
热门标签
PHP1.CN | 中国最专业的PHP中文社区 | PNG素材下载 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有