无法解析json Bower package.json文件

时间:2013-11-26 15:39:21

标签: ubuntu bower

我正在关注本教程https://www.digitalocean.com/community/articles/how-to-install-and-use-bower-on-your-vps我收到了您在下面看到的错误。任何想法可能是什么问题?在远程服务器Ubuntu 13.0.4上安装Bower ..安装git core后,它告诉我运行npm install -g bower。当我这样做时,它会给我一个关于package.json文件的错误消息。但是,我想知道这是否是一个准确的错误消息,因为我可以在我的本地机器上安装bower而没有问题。

npm http 304 https://registry.npmjs.org/tar
npm http 304 https://registry.npmjs.org/unzip
npm http 304 https://registry.npmjs.org/tmp
npm http 304 https://registry.npmjs.org/update-notifier
npm http 304 https://registry.npmjs.org/which
npm ERR! Failed to parse json
npm ERR! Unexpected end of input
npm ERR! File: /home/michael/.npm/rimraf/2.2.2/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.8.0-19-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "bower"
npm ERR! cwd /home/michael
npm ERR! node -v v0.10.22
npm ERR! npm -v 1.3.14
npm ERR! file /home/michael/.npm/rimraf/2.2.2/package/package.json
npm ERR! code EJSONPARSE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/michael/npm-debug.log
npm ERR! not ok code 0

/home/michael/npm-debug.log中包含的信息只是READ.me中包含的标准信息,它不处理此问题。什么想法可能是错的?

1 个答案:

答案 0 :(得分:10)

类似的问题(虽然osx)和这个解决方案有效:https://github.com/bower/bower/issues/877

  

执行:npm cache clean