Pycharm 上的 AWS 无服务器应用程序模型初始化错误

Utk*_*Can 7 amazon-web-services pycharm aws-sam-cli aws-sam

我正在尝试在 Pycharm 上创建新的 AWS 无服务器应用程序,但收到此错误:

Could not execute `sam init`!: [Cloning from https://github.com/aws/aws-sam-cli-app-templates (process may take a moment),
Error: Unstable state when updating repo. Check that you have permissions to create/delete files
Run Code Online (Sandbox Code Playgroud)

我怎么解决这个问题 ?

Details:

OS:Windows 10 , x64
Version: Python 3.9, SAM CLI- 1.53.0
IDE: Pycharm 2022.1.3 Pro Edition
Git Version 2.37
Run Code Online (Sandbox Code Playgroud)

小智 7

在管理员模式下打开 PowerShell 并输入并执行

New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" `
-Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
Run Code Online (Sandbox Code Playgroud)

为我工作。(也修复了 init 中的 webstorm aws 工具包错误)


Utk*_*Can 5

好的,这里是发生此问题的原因以及针对 Windows 用户的解决方案:

问题出在 Windows 中包含空格的路径(“AWS SAM”)导致问题:通过调用 --location arg 并将完整路径放在双引号中,它可以工作

sam init --location "C:\Users[您的用户名]\AppData\Roaming\AWS SAM\aws-sam-cli-app-templates\python3.9\cookiecutter-aws-sam-hello-python"

参考:https: //github.com/aws/aws-sam-cli/issues/1891

谢谢:

https://github.com/hawflau

https://github.com/john-zenden