vue create项目,创建失败的解决办法。

创建新的demo失败,报下面的这个错误:

PS D:\VUE项目\demo> vue create demo        
vue : 无法加载文件 D:\Project\nodejs\node_global\vue.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ vue create demo
    + CategoryInfo          : SecurityError: (:) [],PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
PS D:\VUE项目\demo> vue create demo
vue : 无法加载文件 D:\Project\nodejs\node_global\vue.ps1,因为在此系统上禁止运行脚本。有关详细信息,请参阅 https:/go.microsoft.com/fwlink/?LinkID=135170 中的 about_Execution_Policies。
所在位置 行:1 字符: 1
+ vue create demo
+ ~~~
    + CategoryInfo          : SecurityError: (:) [],PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

出现这个错误刚开始以为是因为刚重装电脑没有安装VueCI脚手架,后面也试着在CMD环境下去输入:

npm install -g @vue/cli 

去安装VueCI 脚手架,也没有达到效果且报错了。

后面通过多方查询,运行Windows PowerShell(管理员)(A),Windows PowerShell(管理员)(A)的运行方法有多种:

方法一: 直接在cmd中执行powershell,切换为powershel

方法二:开始菜单----鼠标右键----powershell启动

在里面输入

set-ExecutionPolicy RemoteSigned

并且输入Y键就解决了。

Vue create创建新项目效果如下:

Guess you like

Origin blog.csdn.net/weixin_44684272/article/details/118439756
Recommended