PowerShell execution policy preventing npm create vite command in VS Code

I’m facing a security problem in PowerShell when trying to execute the npm create vite command from my VS Code terminal. The error message indicates that the npm.ps1 script cannot be executed because it lacks a digital signature.

npm : File C:\Program Files\nodejs\npm.ps1 cannot be loaded. The file 
C:\Program Files\nodejs\npm.ps1 is not digitally signed. You cannot run 
this script on the current system.
+ npm create vite@latest my-project
+ ~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

I’m just trying to set up a new Vite project, but Windows is blocking my ability to run npm commands. What steps can I take to resolve this execution policy problem?

Had this same problem a few months back setting up Windows 11 for dev work. PowerShell’s execution policy is blocking you. Open PowerShell as admin and run Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser. This lets your local scripts run but keeps remote ones signed for security. Fixed my npm issues right away. RemoteSigned works great for dev - good mix of security and actually being able to get stuff done. Don’t forget to restart your VS Code terminal after changing the policy so it picks up the new settings. Been using this setup on all my projects since.

still stuck? check your execution policy with Get-ExecutionPolicy. quick fix: run Set-ExecutionPolicy Unrestricted in admin PowerShell (though it’s less secure). or just switch to cmd or git bash - npm runs fine there.