VSC PowerShell. After npm updating packages .ps1 cannot be loaded because running scripts is disabled on this system

Just delete firebase.ps1 file:

File C:\Users\<your account>\AppData\Roaming\npm\firebase.ps1


This is a powershell security policy, to fix it, run Powershell as administrator and run the following

PS C:\> Set-ExecutionPolicy RemoteSigned 

If you don't want to run the command as an administrator but just for the current user, you can add a scope like below

PS C:\> Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

The stricter the policy, the more secure your system becomes.

You can change RemoteSigned to other options like: Restricted, AllSigned, RemoteSigned, Unrestricted

Source: https://tecadmin.net/powershell-running-scripts-is-disabled-system/

Alternatively you can modify C:\Program Files\PowerShell\7\powershell.config.json using a text editor and add or modify the following section.

{
   ....

   "Microsoft.PowerShell:ExecutionPolicy":  "RemoteSigned"
}

  1. search for powershell
  2. right click and run as administration
  3. run this simple command Set-ExecutionPolicy RemoteSigned
  4. Press A And Enter

A little clarification: when you run PowerShell as Admin, in most cases you don't need to note a path. Just type:

Set-ExecutionPolicy RemoteSigned

then press "A", then "Enter"


Also, one thing worth mentioning is that you need to open PowerShell as Admin and then change the policy like so.

PS C:\> Set-ExecutionPolicy RemoteSigned

Reference - Using the Set-ExecutionPolicy Cmdlet