[SOLVED] Ionic: ionic.ps1 cannot be loaded because running scripts is disabled on this system

[SOLVED] Ionic: ionic.ps1 cannot be loaded because running scripts is disabled on this system

When you try to create an Ionic project on Windows for the first time, you probably get the following issue – “ionic.ps1 cannot be loaded because running scripts is disabled on this system”. The article explains how to solve the title issue.

The problem

When you execute an Ionic command like below:

ionic start my-project

You get the following message:

PS C:\Stream\ionic> ionic start my-project
ionic : File C:\Users\BetterCoding\AppData\Roaming\npm\ionic.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see 
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ ionic start tmp-1
+ ~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
PS C:\Stream\ionic> 

The solution

The reason that Ionic script is blocked by PowerShell policy is that the script is unsigned. Based on the PowerShell documentation, you can change the execution policy that allows you to run unsigned scripts. To do that, just run the following command in the Windows terminal. Run it as a user who is going to use Ionic framework.

Set-ExecutionPolicy -Scope CurrentUser  Unrestricted

If you want to set execution policy for all users on computer run the following command as an administrator.

Set-ExecutionPolicy Unrestricted
At the end… May I ask you for something?

If I helped you solve your problem, please share this post. Thanks to this, I will have the opportunity to reach a wider group of readers. Thank You

5 1 vote
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments