Yasho Sagar
Yasho Sagar

Reputation: 123

settings.json: parse error reading settings file

This is my json in the settings.json file:

{ "public": { "Name": "yashwanth" }, "private": { "oAuth": { "linkedin": { "clientId": "", "secret": "" } } } }

And when I run my app

meteor --settings settings.json

the console says

While preparing to run: settings.json: parse error reading settings file

Upvotes: 3

Views: 3136

Answers (3)

BlackPearl
BlackPearl

Reputation: 2775

After investigating thoroughly, I found out the encoding of the json is the one causing issues. It was saved in UTF-8-BOM, changing it to UTF-8 solved the issues.

Upvotes: 0

Metrophobe
Metrophobe

Reputation: 93

I know its an old post but I am answering it just in case anyone encounters this issue. It turns out that it all boils down to the encoding of the file. If the file contains some invalid characters (as in not properly encoded) then meteor complains and you won't be able to parse the file successfully. A really simple workaround to this problem is to copy and paste the 'package.json' located in the root folder to the same folder and rename it to 'settings.json'. You can then edit this file manually by typing in the desired contents. Another thing you should always avoid is to use single quotes. You should avoid using single quotes for name/value pairs and you should always use double ones. A good website for json validation is JSONLint as it will identify any syntax errors you might have. Finally, it is worth noting that Notepad++ should not have any issues saving the file in the desired format. Make sure you use UTF-8 for the encoding.

Hope this helps anyone reading this and having the same problem.

Cheers

Upvotes: 5

Areca
Areca

Reputation: 1292

Parse error occurs if you have an invalid json string in your settings.json. The content of your settings.json seems to be valid however, it is possible that your file contains hidden chars (like UTF byte order mark) possibly because of copy / paste.

Remove the file and recreate it with an editor so that you are sure json has no hidden chars.

Upvotes: 1

Related Questions