. Advertisement .
. Advertisement .
“Ng.ps1 cannot be loaded because running scripts is disabled on this system” is a fairly common problem that any programmer will face. So, what is the cause of it and what are our solutions? Everything will be made clearly to you in this article. Read on it.
How Does The Error “ng.ps1 cannot be loaded because running scripts is disabled on this system” Happen?
When you run your program, you easily get the following error:
ng.ps1 cannot be loaded because running scripts is disabled on this system
This error “ng.ps1 cannot be loaded because running scripts is disabled on this system” occurs because your system’s power shell is now prohibited from running any executable scripts. This issue frequently appears when using the VS Code IDE on Windows 10, where Power Shell is set as a command-line option.
How To Solve The Error “ng.ps1 cannot be loaded because running scripts is disabled on this system”?
Method 1: Follow these steps
Follow these steps to solve the error “ng.ps1 cannot be loaded because running scripts is disabled on this system”:
Step 1: Run the CMD command below in the identical Powershell terminal. It will enable you to run scripts on your system without restriction in the future.
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
The updated PowerShell execution policy is kept in the registry when the scope is set to “User” and carried over between PowerShell sessions and system restarts.
Step 2: You must ensure that all CMD and VS Code instances must be closed to reflect the changes.
Method 2: Run the command below
Run the command below to enable the script to run in the current PowerShell session if you only want to execute it once:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process
The scope of the command mentioned above is set to “Process”. This implies that only the current process is valid for the new execution policy. The previous restrictions continue to be in effect outside of this particular PowerShell session.
What is the execution policy of PowerShell?
The execution policy of PowerShell is a security attribute that controls the circumstances under which the program reads configuration files and executes scripts. This function aids in preventing dangerous scripts from running.
You can provide an execution policy for the local computer, the current user, or a specific session on a Windows computer. A Group Policy setting can be used to specify execution policies for users and computers.
Individual solutions provided in these tools are several of the most basic for anyone encountering the problem “ng.ps1 cannot be loaded because running scripts is disabled on this system“. If you still need help or have any questions, we have a growing community of people who are usually happy to help you. Furthermore, we anticipate a more creative day full of new ideas and code.