使用Meteor.settings功能 [英] Using the Meteor.settings feature
问题描述
Meteor最近从v0.5.4开始添加了一个全新的 Meteor.settings 对象.而且以一种非常烦人的方式,在他们的文档中没有正确地举例说明如何设置设置.
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.
在我的应用中,我有一个文本文件(在根目录中),名为"settings.json":
In my app, I have a text file (in the root) called "settings.json":
{
"initURL" : "http://localhost:60326/"
}
但是当我尝试使用meteor --settings settings.json
启动应用程序时,出现以下错误:
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)
有人知道我的Meteor应用程序的设置有什么问题吗?
Does anyone have any idea what could be wrong with my Meteor app's settings?
推荐答案
您的settings.json
中有隐藏的字符,可能是由于复制粘贴所致.
You have hidden characters in your settings.json
, probably due to a copy-paste.
您最好的选择是删除文件并手动编写,或者获取一个可以查看所有这些unicode字符并将其删除的文本编辑器.
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.
这篇关于使用Meteor.settings功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!