PowerShell script execution blocked after npm package updates in Visual Studio Code

Help! Can’t run scripts in VS Code PowerShell terminal

I’m stuck after updating some npm packages. Now I can’t run any Firebase or Vue commands in my PowerShell terminal. It keeps saying scripts are disabled on my system.

Here’s what I see:

Error: File cannot be loaded. Running scripts is disabled.
CategoryInfo: SecurityError: (:) [], PSSecurityException
FullyQualifiedErrorId: UnauthorizedAccess

This started right after I updated Firebase tools and Vue. It was all working fine before. I didn’t change any settings or permissions.

I can still use these commands in the regular CMD terminal, but that’s not ideal.

Anyone know how to fix this without messing with system-wide PowerShell settings? I’m on Windows 10 Home (Version 1903) and using VS Code 1.37.1.

Thanks for any help!

I’ve run into this exact problem before, and it can be super frustrating. In my experience, it’s often caused by Windows Defender or antivirus software getting overzealous after updates. What worked for me was adding an exception for VS Code in Windows Defender.

Go to Windows Security > Virus & threat protection > Manage settings. Under ‘Exclusions’, add the path to your VS Code executable. This tells Defender to trust VS Code and not block its scripts.

Also, check if your npm is up to date. Sometimes outdated npm can cause weird permission issues. Run ‘npm -v’ to check the version, and update if needed.

If those don’t work, you might need to temporarily change your execution policy as a last resort. But try the Defender exception first – it’s safer and worked wonders for me.

This issue often crops up after updates to development tools. It’s likely related to PowerShell’s execution policy, which can sometimes be affected by software installations or updates. Here’s a potential fix you can try without changing system-wide settings:

  1. Open VS Code as an administrator.
  2. In the PowerShell terminal, run: Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass

This temporarily changes the execution policy for just that VS Code session. It should allow you to run your scripts again without compromising system security.

If that doesn’t work, you might need to check if your PATH environment variable was altered during the updates. Sometimes package managers can modify these settings, affecting how PowerShell finds and executes commands.

Let me know if this helps or if you need further assistance!

yo, i had this problem too. its annoying af. try running this in ur powershell terminal:

Set-ExecutionPolicy RemoteSigned -Scope CurrentUser

it fixed it for me without messin with system stuff. if that dont work, maybe ur PATH got screwed up? check if the paths to ur npm and node are still there. good luck man