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
- Open PowerShell as Administrator.
- Search for "PowerShell" in the Windows Start menu.
- Right-click on Windows PowerShell (or PowerShell).
- Select Run as administrator.
- Change the execution policy for the current user.
- In the Administrator PowerShell window, run the following command:
- Confirm the change.
- You will be prompted to confirm if you want to change the execution policy. Type and press .
- Verify the new policy (Optional).
- You can check the current effective execution policy by running:
- The output should be .
- Run your npm command again.
For more detailed information on PowerShell execution policies, you can refer to the official Microsoft Learn documentation. [3]
The error:
.png)
.png)
.png)
.png)
Facing the “npm.ps1 cannot be loaded because running scripts is disabled on this system” error while running npm create vite@latest in VS Code usually happens due to PowerShell execution policy restrictions blocking script execution. If you’re building projects but struggling with growth, a professional Digital Marketing Agency can help scale your visibility. From SEO to paid ads and social media management, we drive targeted traffic and real results. Let’s turn your development skills into a powerful online brand that attracts clients consistently.
ReplyDelete