一,创建Vue项目时出现一下错误
vue : 无法加载文件 C:\Users\hp\AppData\Roaming\npm\vue.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中
的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ vue init webpack demo2
+ ~~~
+ CategoryInfo : SecurityError: (:) [],PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
二,解决方法
以管理员权限打开windows powershell,输入set-ExecutionPolicy RemoteSigned,选择y或者a即可。
如果输入set-ExecutionPolicy RemoteSigned,出现以下错误:
set-ExecutionPolicy : 对注册表项“HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PowerShell\1\ShellIds\Microsoft.PowerShel l”的访问被拒绝。 要更改默认(LocalMachine)作用域的执行策略。
1》Windows+R;
2》输入PowerShel l;
3》运行 "Set-ExecutionPolicy -Scope CurrentUser";
4》出现ExecutionPolicy: ,填入RemoteSigned;
再次以管理员权限打开windows powershell,输入set-ExecutionPolicy RemoteSigned,选择y或者a即可。