2014-05-08 45 views
1

我有一個簡單的package.json,並且正在嘗試將grunt添加到我的項目中。我已經做了很多次,但從來沒有遇到這個問題添加grunt到開發依賴關係時無法解析json

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 [email protected] 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 

回答

8

npm cache clean是我所需要的

+0

爲什麼這有幫助? –