JohnMcLear / draw

A real time collaborative drawing tool using nodejs, socket.io & paper.js
Apache License 2.0
482 stars 158 forks source link

There was an error processing your settings.json file: Unexpected token } #189

Closed ocdtrekkie closed 9 years ago

ocdtrekkie commented 9 years ago

I am getting this error when attempting to run this using the instructions on the readme. I looked at the settings.json file and it appears valid to me, so I'm not sure if I did something wrong or there's a bug. If you know what might cause this, I'd appreciate the advice.

JohnMcLear commented 9 years ago

Does your settings.json validate? Try it.

On 22 May 2015 17:00, Jacob Weisz notifications@github.com wrote:

I am getting this error when attempting to run this using the instructions on the readme. I looked at the settings.json file and it appears valid to me, so I'm not sure if I did something wrong or there's a bug. If you know what might cause this, I'd appreciate the advice.

— Reply to this email directly or view it on GitHubhttps://github.com/JohnMcLear/draw/issues/189.

ocdtrekkie commented 9 years ago

My settings.json file seems to be the exact contents of settings.json.template in the repo. (Such and such validators specify that the file "is not JSON". Deleting the settings.json file and rerunning it recreates it similarly and it fails again.

JohnMcLear commented 9 years ago

Sounds like it isn't...

On 22 May 2015 17:36, Jacob Weisz notifications@github.com wrote:

My settings.json file seems to be the exact contents of settings.json.template in the repo. (Such and such validators specify that the file "is not JSON".

— Reply to this email directly or view it on GitHubhttps://github.com/JohnMcLear/draw/issues/189#issuecomment-104706927.

ocdtrekkie commented 9 years ago

That appears to be the case.

So, your settings.json.template is not valid JSON either then, if I understand correctly. And if I understand the code correctly, the installDeps.sh file in your /bin seems to just copy the template to the settings file, if it doesn't exist.

ocdtrekkie commented 9 years ago

So, from my understanding, JSON cannot have comments: http://stackoverflow.com/questions/244777/can-i-comment-a-json-file

settings.json.template, however, states that comments are allowed, and it has comments. And the installDeps.sh file does not appear to strip them when creating settings.json.

ocdtrekkie commented 9 years ago

Ah, I see EtherDraw removes comments here: https://github.com/JohnMcLear/draw/commit/e3f9a6752b66e299de9f4f230b5030a5a2eb7761

Which is why settings.json, as created by EtherDraw, does not work correctly in a validator, but may/should work correctly in EtherDraw itself.

ocdtrekkie commented 9 years ago

Okay, I just found the bug.

Your "tool" line, the last uncommented config line in settings.json.template, has a trailing comma, and it shouldn't.

ocdtrekkie commented 9 years ago

Pull request #191 proposed to ensure this program works "out of the box" with readme instructions.

JohnMcLear commented 9 years ago

Shit.. Good spot. No idea how I missed that....

JohnMcLear commented 9 years ago

Thanks for fix

JohnMcLear commented 9 years ago

PS sorry for short responses last night I was afk

ocdtrekkie commented 9 years ago

No problem, I got it working. Learned a thing or two figuring it out too.