创建Vue项目时出现一下错误:
> vue create [项目名]
PS D:\vue> vue --version vue : 无法加载文件 C:\Users\86185\AppData\Roaming\npm\vue.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/ go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。 所在位置 行:1 字符: 1 + vue --version + ~~~ + 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)作用域的执行策略。
- Windows+R;
- 输入PowerShel l;
- 运行 "Set-ExecutionPolicy -Scope CurrentUser";
- 出现ExecutionPolicy: ,填入RemoteSigned;
再次以管理员权限打开windows powershell,输入set-ExecutionPolicy RemoteSigned,选择y或者a即可。