When using PowerShell to create Vue project, the following error occurred, resulting in creation failure:
vue : The file D:\Program Files\nodejs\node_global\vue.ps1 could not be loaded, because running scripts is disabled on this system. For more information, see about_Execution_Policies in https:/go.microsoft.com/fwlink/?LinkID=135170
1. PowerShell’s execution policy prevented the operation.
use Get-ExecutionPolicy
Check and find that the execution policy is restricted:
PS D:\workspace\test> Get-ExecutionPolicy Restricted
At the same time, PowerShell gives us the method to solve the problem
2. At this time, enter the command set executionpolicy – scope currentuser as required, press enter, enter remotesigned in the black window to release the restricted status, press enter, execute the policy change, and select y
PS D:\workspace\test> Set-ExecutionPolicy -Scope CurrentUser cmdlet Set-ExecutionPolicy in command pipeline location 1 Please provide values for the following parameters: ExecutionPolicy: RemoteSigned Execution Policy Changes The execution policy helps you prevent the execution of untrusted scripts. Changing the execution policy may create a security risk, as shown in https:/go.microsoft.com/fwlink/?LinkID=135170 as described in the about_Execution_Policies help topic. Do you want to change the execution policy? [Y] Yes(Y) [A] All Yes(A) [N] No(N) [L] All No(L) [S] Suspend(S) [?] Help (default value is "N"): y
3. Next, let’s check the restricted status, Enter get executionpolicy, and the result will be remotesigned, so that we can create it normally
PS D:\workspace\test> Get-ExecutionPolicy RemoteSigned PS D:\workspace\test>