Anurag Bhandari
Anurag Bhandari

Reputation: 633

Using the Meteor.settings feature

Meteor recently added a brand new Meteor.settings object starting v0.5.4. And in an extremely annoying manner, didn't properly explain, with example, in their documentation how to setup settings.

In my app, I have a text file (in the root) called "settings.json":

{
    "initURL" : "http://localhost:60326/"
}

But when I try to start the app using meteor --settings settings.json, I get the following error:

undefined:1
{
^
SyntaxError: Unexpected token 
    at Object.parse (native)
    at Object.exports.getSettings (C:\Program Files (x86)\Meteor\app\meteor\run.
js:537:10)
    at start_server (C:\Program Files (x86)\Meteor\app\meteor\run.js:239:28)
    at exports.run.restart_server (C:\Program Files (x86)\Meteor\app\meteor\run.
js:655:21)
    at C:\Program Files (x86)\Meteor\app\meteor\run.js:726:9
    at Socket.exports.launch_mongo (C:\Program Files (x86)\Meteor\app\lib\mongo_
runner.js:187:9)
    at Socket.EventEmitter.emit (events.js:93:17)
    at Pipe.onread (net.js:391:31)

Does anyone have any idea what could be wrong with my Meteor app's settings?

Upvotes: 3

Views: 8708

Answers (1)

Tarang
Tarang

Reputation: 75945

You have hidden characters in your settings.json, probably due to a copy-paste.

Your best bet is to delete the file and write it manually, or to get a text editor that can view all these unicode characters and remove them.

Upvotes: 8

Related Questions