【问题标题】:Error in AWS CLI (Amplify) when executing the "amplify init" command in windows environment (for an android studio project)在 Windows 环境中执行“amplify init”命令时出现 AWS CLI (Amplify) 错误(对于 android studio 项目)
【发布时间】:2019-04-17 03:17:41
【问题描述】:

我是 AWS SDK 的新手,我正在尝试使用 AWS SDK for mobile 创建一个新的 android studio 项目。 我的最终目标是让 AWS SDK 在我的 Android 工作室项目上运行,我尝试在 Gradle 上添加依赖项,但它并不是我需要的所有包,它对我没有帮助,因此我遵循了官方 AWS 文档,它引导我 Amplify命令行界面。

按照官方 AWS 文档 (this is the link to the documentation page I'm talking about) 的建议,我按照建议的所有步骤进行操作,并且有这个步骤与命令:

$amplify init

这会为我返回以下错误:

init failed
{Error: D:\EDUCATION\Developer\Final_Year_Project\MusicAppAWS\D:\EDUCATION\Developer\Final_Year_Project\MusicAppAWS\app\src\main\res\raw contains invalid WIN32 path characters 
at Object.mkdirsSync (C:\Users\eldho\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-frontend-android\node_modules\fs-extra\lib\mkdirs\mkdirs-sync.js:18:22)
    at generateAWSConfigFile (C:\Users\eldho\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-frontend-android\lib\frontend-config-creator.js:110:6)
    at createAWSConfig (C:\Users\eldho\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-frontend-android\lib\frontend-config-creator.js:32:3)
    at Object.createFrontendConfigs (C:\Users\eldho\AppData\Roaming\npm\node_modules\@aws-amplify\cli\node_modules\amplify-frontend-android\index.js:23:10)
    at Object.onCategoryOutputsChange (C:\Users\eldho\AppData\Roaming\npm\node_modules\@aws-amplify\cli\src\extensions\amplify-helpers\on-category-outputs-change.js:22:33)
    at initializeEnv (C:\Users\eldho\AppData\Roaming\npm\node_modules\@aws-amplify\cli\src\lib\initialize-env.js:79:27)
    at process._tickCallback (internal/process/next_tick.js:68:7) code: 'EINVAL'}

================================================ ========================== 错误截图: link to the screenshot of the error in Amplify CLI

我在 Windows 命令提示符下运行它。 我记得在 github 上读过一个类似的问题,说这可能是一个错误,因为路径中包含诸如“:”之类的字符,如“amplify-frontend-android\index.js:23:10”中不支持 Windows。我是编码初学者,不知道如何解决这个问题。

【问题讨论】:

    标签: android aws-sdk aws-cli aws-amplify


    【解决方案1】:

    运行后

    $amplify init

    Amplify CLI 会提示您几个问题,提示中的一个问题是:

    ? Where is your Res directory:

    为此,您需要提供 Res 目录的相对路径,例如:

    ? Where is your Res directory:app\src\main\res

    而不是提供完整路径,例如:

    ? Where is your Res directory: D:\EDUCATION\Final_Year_Project\Demo2\app\src\main\res

    在撰写此答案时(2019 年 4 月 18 日),放大 CLI 并未针对自行解决此问题进行优化。我们希望在未来的版本中将此视为增强,因此它应该在未来的版本中自行解决。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-02-03
      • 2020-05-16
      • 1970-01-01
      • 1970-01-01
      • 2020-08-14
      相关资源
      最近更新 更多