【问题标题】:Ionic SyntaxError: Unexpected token A in JSON at position 0Ionic SyntaxError:JSON 中位置 0 的意外标记 A
【发布时间】:2018-09-08 12:41:29
【问题描述】:

我在命令提示符下运行ionic 后收到此错误,并且问题一直存在,直到我删除~/.ionic/config.json,但稍后它又开始显示此错误消息。 我该如何真正摆脱这个? (Windows 10 用户)

这是 config.json 的内容:

{
  "lastCommand": "2017-06-21T14:57:29.860Z",
  "urls": {
    "api": "https://api.ionic.io",
    "dash": "https://apps.ionic.io"
  },
  "user": {},
  "tokens": {
    "appUser": {},
    "telemetry": "501f31d8-48d1-4cd0-9919-68ccb7b1e30a"
  },
  "cliFlags": {
    "confirm": false,
    "interactive": true,
    "telemetry": true,
    "yarn": false
  }
}

我意识到在每次执行 ionic 期间只有 "lastCommand" 发生变化,总的来说,我通过 git 对其进行了监控,并恢复到最后一个没有帮助的工作配置文件。

ionic.config.json 的内容:

{
  "name": "restaurant",
  "app_id": "",
  "type": "ionic-angular"
}

【问题讨论】:

  • 能否请您添加您的ionic.config.json 文件的内容?

标签: ionic-framework ionic2


【解决方案1】:

在 Notepad++ 中打开您的配置文件并检查编码格式。编码格式应该是 UTF-8 而不是别的,甚至不是 UTF-8 BOM。如果是,请将其更改为 UTF-8。保存文件并尝试再次运行它。希望能帮助到你。这主要发生在您在记事本中编辑 json 文件时。

注意:请勿使用记事本执行上述步骤,因为记事本认为 UTF_8 和 UTF-8-BOM 相同。

【讨论】:

    猜你喜欢
    • 2019-09-21
    • 2020-06-10
    • 1970-01-01
    • 1970-01-01
    • 2020-01-10
    • 2017-08-21
    • 1970-01-01
    • 1970-01-01
    • 2018-07-01
    相关资源
    最近更新 更多