Wednesday, December 17, 2025

Error you get when running "npm create vite@latest in VS code : "npm.ps1 cannot be loaded because running scripts is disabled on this system. "

 

The error "running scripts is disabled on this system" occurs because the PowerShell execution policy, a Windows security feature, is set to Restricted by default. To fix this, you need to change the execution policy to for the current user, which allows your locally created scripts to run while still requiring downloaded scripts to be digitally signed. [1, 2, 3]


Steps to Resolve the Error
  1. Open PowerShell as Administrator.
    • Search for "PowerShell" in the Windows Start menu.
    • Right-click on Windows PowerShell (or PowerShell).
    • Select Run as administrator.
  2. Change the execution policy for the current user.
    • In the Administrator PowerShell window, run the following command:
  3. Confirm the change.
    • You will be prompted to confirm if you want to change the execution policy. Type and press .
  4. Verify the new policy (Optional).
    • You can check the current effective execution policy by running:
    • The output should be .
  5. Run your npm command again.
    • You should now be able to run your commands without encountering the script execution error. You may need to restart your terminal or VS Code for the changes to take effect. [2, 4, 5, 6, 7]
For more detailed information on PowerShell execution policies, you can refer to the official Microsoft Learn documentation. [3]



The error:

The solution:

The effect







No comments:

Post a Comment

Adding new files to remote github repository

  To add new files to a remote GitHub repository, you can use the command line (Git Bash, Terminal) for a local workflow or the GitHub websi...