When you first try to run a PowerShell
*.ps1 script on Windows, you will probably get the following error message:
By default, all Windows versions - Windows 11, Windows 10, Windows 7, Windows Server,... - have the script execution disabled for security reasons.
The complete error message looks like this:
PS D:\Projects\test> nest new nest-demo-1 nest : File C:\Users\Mike\AppData\Roaming\npm\nest.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 + nest new nest-demo-1 + ~~~~ + CategoryInfo : SecurityError: (:) , PSSecurityException + FullyQualifiedErrorId : UnauthorizedAccess
To fix this error, you need to enable script execution by changing the execution policy. You need to take the following steps:
If you use the Terminal app then check if it opens a PowerShell Windows:
- Execute the following code to allow the script execution:
This command will set the execution policy to RemoteSigned, which allows the execution of local scripts that are signed by a trusted publisher.
- Execute your original command. It should work without the error.