Last Updated: February 25, 2016
· sebastialonso

Npm install fails due to Syntax Error

While playing with Yeoman, something like this happened

569 error Failed to parse json
569 error Unexpected token }
570 error File: /home/seba/.npm/commander/2.1.0/package/package.json
571 error Failed to parse package.json data.
571 error package.json must be actual JSON, not just JavaScript.
571 error
571 error This is not a bug in npm.
571 error Tell the package author to fix their package.json file. JSON.parse
572 error System Linux 3.13.0-36-generic
573 error command "/home/seba/.nvm/v0.11.13/bin/node" "/home/seba/.nvm/v0.11.13/bin/npm" "install"
574 error cwd /home/seba/repos/angularApps/todo
575 error node -v v0.11.13
576 error npm -v 1.4.9
577 error file /home/seba/.npm/commander/2.1.0/package/package.json
578 error code EJSONPARSE
579 verbose exit [ 1, true ]

Doing Google research I came up with this issue.

At the end, all it took was

npm cache clean -g

and everything was good again.