powershell - SecurityError in PS terminal when Running AWS Amplify app - Stack Overflow

admin2025-04-21  2

I'm new to Amplify and currently following an AWS tutorial on building a Flutter mobile app using Amplify. When I tried to run the amplify init statement for the first time, when the tutorial told me to, I received the following error.

C:\Users\username\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/fwlink/?LinkID=135170.
At line:1 char:1
+ amplify init
+ ~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
PS D:\FlutterApps\amplify_trips_planner>

I looked through the article linked in the message but couldn't find or at least didn't recognize anything similar to the error message I was given.

Let me know what else I need to share.

I'm new to Amplify and currently following an AWS tutorial on building a Flutter mobile app using Amplify. When I tried to run the amplify init statement for the first time, when the tutorial told me to, I received the following error.

C:\Users\username\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 init
+ ~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
PS D:\FlutterApps\amplify_trips_planner>

I looked through the article linked in the message but couldn't find or at least didn't recognize anything similar to the error message I was given.

Let me know what else I need to share.

Share Improve this question asked Jan 22 at 22:50 mrDmrD 192 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Your symptom implies that your effective execution policy requires that all scripts be signed (the AllSigned policy).

Therefore, your options are:

  • Either: Sign the script in question.

  • Or: Change the effective execution policy to not require signing (which comes at the expense of security).

    • E.g., Set-ExecutionPolicy -Force -Scope CurrentUser RemoteSigned would change the effective policy for your user account to only require signing for scripts downloaded from the internet.

    • However, this would not work if the effective execution policy is controlled via GPOs (Group Policy Objects).

    • See this answer for additional information.

转载请注明原文地址:http://anycun.com/QandA/1745225060a90450.html