【发布时间】:2022-01-25 10:13:04
【问题描述】:
我从 AWS for windows 的 msi 安装程序安装了 AWS SAM。
运行安装程序后,我在 cmd 和 powershell 中运行了sam --version。
PS C:\Users\dgupta> sam --version
SAM CLI, version 1.26.0
它返回我刚刚安装的版本。但是在 VS 代码中,我打开了一个终端并运行 sam --version 它出错了。
Windows PowerShell
Copyright (C) Microsoft Corporation. All rights reserved.
Try the new cross-platform PowerShell https://aka.ms/pscore6
sam : The term 'sam' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, g of the name,
or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ sam --version
+ ~~~
+ CategoryInfo : ObjectNotFound: (sam:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
为什么会这样? VS Code 终端和普通终端不能访问相同的环境变量吗?
【问题讨论】:
-
我不确定到底是什么修复了它,我认为它与 docker 相关。找不到 sam 命令。所以我删除并重新安装了docker。在 path 变量中编辑了 python.exe 的路径。重新安装了 SAM,我没有重新启动计算机,而是将其关闭并在没有 Windows 更新的情况下启动它。
标签: powershell visual-studio-code aws-sam-cli