简体   繁体   English

由于 amplify.ps1 安全问题,命令“amplify configure”无法运行

[英]command "amplify configure" can not run due to amplify.ps1 security issue

I am using aws amplify and am trying to run the command "amplify configure" in my root directory but keep getting this error response我正在使用 aws amplify 并尝试在我的根目录中运行命令“amplify configure”但不断收到此错误响应

amplify: File C:\Users\munet\AppData\Roaming\npm\amplify.ps1 cannot be loaded.放大:无法加载文件 C:\Users\munet\AppData\Roaming\npm\amplify.ps1。 The file C:\Users\munet\AppData\Roaming\npm\amplify.ps1 is not digitally signed.文件 C:\Users\munet\AppData\Roaming\npm\amplify.ps1 未进行数字签名。 You cannot run this script on the current system.您不能在当前系统上运行此脚本。 For more information about running scripts and setting execution policy, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.有关运行脚本和设置执行策略的详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 上的 about_Execution_Policies。 At line:1 char:1在行:1 字符:1

  • amplify configure放大配置
  •  + CategoryInfo: SecurityError: (:) [], PSSecurityException + FullyQualifiedErrorId: UnauthorizedAccess

I tried unblocking the file in powershell but it still displays the same error.我尝试取消阻止 powershell 中的文件,但它仍然显示相同的错误。 I even went to the file in my AppData folder, clicked properties and the check to mark unblock was not an option.我什至去了我的 AppData 文件夹中的文件,单击属性,并且检查以标记取消阻止不是一个选项。 I am wondering what else it could be that is preventing this file from being run.我想知道还有什么可能阻止此文件运行。 I am thinking I have to digitally sign the script but am unsure where to.我想我必须对脚本进行数字签名,但不确定在哪里。 Here is a link to where the solution may possibly be.这是指向解决方案可能所在位置的链接。 I will upload the solution if I find.如果我找到了,我会上传解决方案。 Thanks.谢谢。

https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.1#remotesigned https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.1#remotesigned

The solution to this problem is rather simple.这个问题的解决方案相当简单。 You're running this command in Powershell.您正在 Powershell 中运行此命令。 Sometimes it can help to run powershell as an administrator but the best solution is just to run it in Command Prompt (cmd)有时以管理员身份运行 powershell 会有所帮助,但最好的解决方案是在命令提示符 (cmd)中运行它

You can also bypass that security check by running this command:您还可以通过运行以下命令绕过该安全检查:

Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

Or just use:或者只是使用:

set-ExecutionPolicy RemoteSigned -Scope CurrentUser 

But not both as they will conflict between each other但不是两者都有,因为它们会相互冲突

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM