首页 > 解决方案 > 运行 amplify init --appId XXX 时出现语法错误

问题描述

我正在使用放大控制台编写一个 React Webapp。在安装 cli 时,我按照“设置后端环境”下的步骤操作,其中包括:

$ npm install -g @aws-amplify/cli

$ amplify init --appId IDNUMBER

但是第二个命令会抛出此错误消息:

Unexpected token d in JSON at position 0
SyntaxError: Unexpected token d in JSON at position 0
    at JSON.parse (<anonymous>)
    at normalizeValue (/usr/lib/node_modules/@aws-amplify/cli/lib/lib/input-params-manager.js:31:32)
    at /usr/lib/node_modules/@aws-amplify/cli/lib/lib/input-params-manager.js:6:31
    at Array.forEach (<anonymous>)
    at normalizeInputParams (/usr/lib/node_modules/@aws-amplify/cli/lib/lib/input-params-manager.js:4:45)
    at constructExeInfo (/usr/lib/node_modules/@aws-amplify/cli/lib/commands/init.js:72:22)
    at /usr/lib/node_modules/@aws-amplify/cli/lib/commands/init.js:52:21
    at step (/usr/lib/node_modules/@aws-amplify/cli/lib/commands/init.js:33:23)
    at Object.next (/usr/lib/node_modules/@aws-amplify/cli/lib/commands/init.js:14:53)
    at /usr/lib/node_modules/@aws-amplify/cli/lib/commands/init.js:8:71

我无法识别它试图读取的 JSON 文件。

标签: amazon-web-servicesaws-amplifyaws-amplify-cli

解决方案


推荐阅读