找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 322|回复: 0

[通用] vue : 无法加载文件 vue.ps1。未对文件ue.ps1 进行 数字签名。无法在当前系统上运行

[复制链接] IP属地:广东省广州市
发表于 2024-7-5 20:13:10 | 显示全部楼层 |阅读模式
You're experiencing a common issue on Windows when trying to run vue commands. This error is due to Windows' PowerShell security policies preventing the execution of unsigned scripts.
Here are a few ways to resolve this issue:
Method 1: Run PowerShell as Administrator
  • Right-click on the PowerShell icon in the Start menu and select "Run as Administrator".
  • In the elevated PowerShell console, run the command Get-ExecutionPolicy to check the current execution policy.
  • If the policy is set to Restricted, run the command Set-ExecutionPolicy Unrestricted to change it to Unrestricted.
  • Restart PowerShell and try running the vue command again.
Method 2: Sign the script (requires administrative privileges)
  • Open PowerShell as Administrator (as above).
  • Run the command Get-AuthenticodeSignature C:\Users/Admin\AppData\Roaming\npm\vue.ps1 to check the script's digital signature.
  • Since the script is not signed, you'll get an error. Run the command Set-AuthenticodeSignature -FilePath C:\Users\Admin\AppData\Roaming\npm\vue.ps1 to sign the script.
  • Restart PowerShell and try running the vue command again.
Method 3: Create a new PowerShell profile (recommended)
  • Open PowerShell as Administrator (as above).
  • Run the command New-Item -Path $PROFILE -ItemType File -Force to create a new PowerShell profile file.
  • Open the newly created profile file in a text editor (e.g., notepad.exe $PROFILE) and add the following line: Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
  • Save the file and restart PowerShell.
After trying one of these methods, you should be able to run vue commands without encountering the " 无法加载文件..." error.

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|西兴社区 ( 蜀ICP备2022005627号 )|网站地图

GMT+8, 2024-12-26 22:33 , Processed in 0.627517 second(s), 22 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表