How to resolve execution policy issues when running npm create vite@latest command?

npm create vite@latest my-vue-app — –template vue
npm : File C:Program Filesnodejsnpm.ps1 cannot be loaded because running scripts is disabled on this system. For more information, see
about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1

  • npm create vite@latest my-vue-app — –template vue
  •   + CategoryInfo          : SecurityError: (:) [], PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
    
    

I’m trying to create a new Vue application using Vite, but I’m encountering an issue related to execution policies. Here’s the command I’m running:

bash
npm create vite@latest my-vue-app — –template vue
However, it seems the execution policy is preventing this from working. To resolve this, I found that adding the following command beforehand bypasses the issue:

bash
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
Once I set the execution policy to bypass, the Vite project creation works as expected.
**
Question:**

  1. Is it safe to bypass the execution policy temporarily like this?

  2. Are there better or more permanent solutions to handle such issues without compromising system security?

Node.js version: 22.17
Operating System:windows 11