【报错】vue create xxxx

PS C:\Users\a-xiaobodou\OneDrive - Microsoft\Projects\Vue+Flask> vue create my-project-from-uaine
vue : File C:\Users\a-xiaobodou\AppData\Roaming\npm\vue.ps1 cannot be loaded. The file C:\Users\a-xiaobodou\AppData\Roaming\npm\vue.ps1 is not digitally
signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ vue create my-project-from-uaine
+ ~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess  

解决方法:

这个错误提示是由于您的系统阻止了未签名的脚本运行。为了解决这个问题,您可以尝试以下方法:

  1. 允许运行未签名的脚本:

    • 打开 PowerShell。
    • 输入以下命令来允许运行未签名的脚本:Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process -Force
  2. 使用 Vue CLI 创建项目:

    • 打开 PowerShell。
    • 导航到您的项目目录:cd C:\Users\a-xiaobodou\OneDrive - Microsoft\Projects\Vue+Flask
    • 使用 Vue CLI 创建项目:vue create my-project-from-uaine

请注意,第一个方法可能会导致安全风险,因为它允许运行任何未签名的脚本。因此,如果您不确定如何安全地设置执行策略,请勿尝试该方法。如果您只是要运行 Vue CLI 命令,建议使用第二个方法。

PS C:\Users\a-xiaobodou\OneDrive - Microsoft\Projects\Vue+Flask> vue create my-project-from-uaine
vue : File C:\Users\a-xiaobodou\AppData\Roaming\npm\vue.ps1 cannot be loaded. The file C:\Users\a-xiaobodou\AppData\Roaming\npm\vue.ps1 is not digitally
signed. You cannot run this script on the current system. For more information about running scripts and setting execution policy, see
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ vue create my-project-from-uaine
+ ~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess
PS C:\Users\a-xiaobodou\OneDrive - Microsoft\Projects\Vue+Flask> Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Scope Process -Force
PS C:\Users\a-xiaobodou\OneDrive - Microsoft\Projects\Vue+Flask> vue create my-project-from-uaine
?  Your connection to the default npm registry seems to be slow.
   Use https://registry.npmmirror.com for faster installation? Yes


Vue CLI v5.0.8
? Please pick a preset: Default ([Vue 3] babel, eslint)


Vue CLI v5.0.8
✨  Creating project in C:\Users\a-xiaobodou\OneDrive - Microsoft\Projects\Vue+Flask\my-project-from-uaine.
  Initializing git repository...
⚙️  Installing CLI plugins. This might take a while...


added 861 packages in 2m
  Invoking generators...
  Installing additional dependencies...


added 101 packages in 26s
⚓  Running completion hooks...

  Generating README.md...

  Successfully created project my-project-from-uaine.
  Get started with the following commands:

 $ cd my-project-from-uaine
 $ npm run serve

PS C:\Users\a-xiaobodou\OneDrive - Microsoft\Projects\Vue+Flask>

你可能感兴趣的:(Web,vue.js,前端,javascript)