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.
|