Trying to use a lib but getting this error...
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse Note that package.json must be actual JSON, not
npm ERR! JSON.parse just a JavaScript object.
npm ERR! JSON.parse
npm ERR! JSON.parse This changed in npm 0.3.0, and is not a bug in npm.
npm ERR! JSON.parse Tell the package author to fix their package.json file.
Not sure what changes are likely needed to make it valid JSON, thanks very much!
I have been through this problem and in my case it was just that in place of comma(,). I have used dot(.). You can simply open it up in any JSON validator and it will help you up. One of the JSON validator's link is as follows . http://www.bodurov.com/JsonFormatter/
Just to complete the answer, you can simply use an online JSON validator to validate your
package.json
.I highly recommend http://jsonlint.com/, paste your
package.json
in the textarea and click on the Validate button, that's all!Valid JSON must have both keys and values of an object in quotes. Surround all of your keys in quotation marks and that should make the error go away.
Reference: JSON spec
Update: I did the dirty work for you. Let me know if this fixes it.
In addition to @Hans Engel's answer use
npm help json
to get the specification of what should be in the package.json fileI also got the same error message, first run
npm package.json
to check errors in package.json file, if not then runnpm cache clean
.Super cool way to fix / validate the package.json :
and you have your json validated or the error line.
Why use jsonlint, sounds pretty lame.