4

I am using aws amplify and am trying to run the command "amplify configure" in my root directory but keep getting this error response

amplify : File C:\Users\munet\AppData\Roaming\npm\amplify.ps1 cannot be loaded. The file C:\Users\munet\AppData\Roaming\npm\amplify.ps1 is not digitally signed. 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. At line:1 char:1

  • amplify configure
  •   + CategoryInfo          : SecurityError: (:) [], PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
    

I tried unblocking the file in powershell but it still displays the same error. I even went to the file in my AppData folder, clicked properties and the check to mark unblock was not an option. 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://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_execution_policies?view=powershell-7.1#remotesigned

  • 1
    Does this answer your question? [Why is my locally-created script not allowed to run under the RemoteSigned execution policy?](https://stackoverflow.com/questions/9742775/why-is-my-locally-created-script-not-allowed-to-run-under-the-remotesigned-execu) – Doug Maurer Dec 02 '20 at 16:55

2 Answers2

3

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

gildniy
  • 3,528
  • 1
  • 33
  • 23
2

The solution to this problem is rather simple. You're running this command in Powershell. Sometimes it can help to run powershell as an administrator but the best solution is just to run it in Command Prompt (cmd)

cmcnphp
  • 400
  • 1
  • 4
  • 14