gpt4 book ai didi

node.js - 无服务器框架 sls 与 Powershell sls 冲突(选择字符串)

转载 作者:搜寻专家 更新时间:2023-10-31 22:18:47 28 4
gpt4 key购买 nike

我使用以下 NPM 命令安装了无服务器框架

npm install -g serverless

当我尝试在 Powershell 中运行无服务器命令 sls 时,我得到一个奇怪的结果,其中提到“cmdlet Select-string”。

sls --version

enter image description here

有人可以帮我解决这个问题吗?

最佳答案

PowerShell 似乎有一个名为 Select-String 的命令/cmdlet,它的别名是 sls。 PowerShell 别名 sls 似乎优先于 sls 的 node.js 无服务器命令。

删除 PowerShell sls 别名的一种方法是在 PowerShell 中运行以下命令

Remove-Item alias:sls

此更改仅适用于当前的 PowerShell session 。

要永久使用 sls PowerShell 别名,您可以更改 Microsoft.PowerShell_profile.ps1 文件。

从 PowerShell 使用以下命令在记事本中打开您的个人资料页面:

notepad $profile

将以下内容添加到文件中并保存。

remove-item alias:sls

可以通过从 Powershell 运行以下命令来重新加载配置文件

. $profile

在我的文件中,您会看到我已经删除了 curl 和 sls 的别名。

Change PowerShell Profile

现在我看到了在 PowerShell 中输入 sls 时的预期结果。 enter image description here

How do I permanently remove a default Powershell alias?

---更新----

一个更简单的选择是使用命令“serverless”而不是“sls”。

关于node.js - 无服务器框架 sls 与 Powershell sls 冲突(选择字符串),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43302843/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com