3
Meteor最近添加了一個全新的Meteor.settings對象,從v0.5.4開始。並且以一種非常煩人的方式,沒有正確解釋例如在他們的文檔中如何設置設置。使用Meteor.settings功能
在我的應用程序,我有一個名爲的文本文件(根)「settings.json」:
{
"initURL" : "http://localhost:60326/"
}
但是當我嘗試使用meteor --settings settings.json
啓動應用程序,我得到以下錯誤:
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)
有沒有人知道我的Meteor應用的設置有什麼問題?
沒有。這是我最初懷疑的,但我通過在記事本,記事本++和Visual Studio中打開文件來確認不存在任何不良字符。 – iamgame
嗯......沒關係。我刪除了舊文件並使用Windows資源管理器重新創建了它。你猜怎麼了?有效! 結果Visual Studio上次錯誤地創建了一個文本文件:p – iamgame
它可能是一個UTF字節順序標記。 Notepad,Notepad ++和Visual Studio支持它們,Meteor顯然不支持它們。 –