settings.json:解析读取设置文件时出错 [英] settings.json: parse error reading settings file

查看:350
本文介绍了settings.json:解析读取设置文件时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在 settings.json 文件中的 json:

This is my json in the settings.json file:

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

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

当我运行我的应用程序时

And when I run my app

meteor --settings settings.json

meteor --settings settings.json

控制台说

准备运行时:settings.json:解析错误读取设置文件

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

推荐答案

我知道这是一个旧帖子,但我会回答它以防万一有人遇到这个问题.事实证明,这一切都归结为文件的编码.如果文件包含一些无效字符(如未正确编码),则meteor 会抱怨并且您将无法成功解析该文件.此问题的一个非常简单的解决方法是将位于根文件夹中的package.json"复制并粘贴到同一文件夹中,并将其重命名为settings.json".然后,您可以通过键入所需的内容来手动编辑此文件.您应该始终避免的另一件事是使用单引号.您应该避免对名称/值对使用单引号,并且应该始终使用双引号.一个很好的 json 验证网站是 JSONLint,因为它会识别您可能遇到的任何语法错误.最后,值得注意的是 Notepad++ 以所需格式保存文件应该没有任何问题.确保使用 UTF-8 进行编码.

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.

干杯

这篇关于settings.json:解析读取设置文件时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆