Error in AWS CLI (Amplify) when executing the “amplify init” command in windows environment (for an android studio project)

纵饮孤独 提交于 2020-07-07 11:13:16

问题


I'am new to the AWS SDK and I'am trying to create a new android studio project with AWS SDK for mobile. My ultimate goal is to get AWS SDK working on my Android studio project, I tried adding dependencies on Gradle, but it does not all all packages I need and it's not helping me, and thus I followed the official AWS documentation which lead me to Amplify CLI.

As suggested by the official AWS documentation (this is the link to the documentation page I'm talking about), I was following along all the steps as recommended and there is this step with the command:

$amplify init

This returns the following error for me:

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'}

======================================================================== Screenshot of the error: link to the screenshot of the error in Amplify CLI

I'am running this in windows command prompt. I remember reading a similar issue in github saying that it might be an error due to the path having characters like ":" as in "amplify-frontend-android\index.js:23:10" that are not suported in windows. I'am a beginner at coding and not sure how to fix this problem.


回答1:


After running the

$amplify init

The Amplify CLI will prompt you for several questions, one of the question in the prompt is:

? Where is your Res directory:

for this you need to provide the relative path to you Res directory, like:

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

instead of providing the full path like:

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

As on writing this answer(18th April 2019), the amplify CLI is not optimized to figure this out on its own. We can hope to see this as an enhancement in the future versions, so it should resolve itself in the future versions.



来源:https://stackoverflow.com/questions/55719364/error-in-aws-cli-amplify-when-executing-the-amplify-init-command-in-windows

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!