Immutable solution version
Firebase CLI: "firebase.ps1 cannot be loaded because running scripts is disabled on this system"
Complete solution
Shows how to fix firebase CLI: "firebase.ps1 cannot be loaded because running scripts is disabled on this system". Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
After npm i -g firebase-tools on Windows, running firebase in the VS Code PowerShell terminal failed with: firebase : File [HOME]\... cannot be loaded because running scripts is disabled on this system.
Steps
- After npm i -g firebase-tools on Windows, running firebase in the VS Code PowerShell terminal failed with: firebase : File [HOME]\... cannot be loaded because running scripts is disabled on this system. The same commands worked in cmd. npm had generated a firebase.ps1 PowerShell shim, and PowerShell's default execution policy blocks unsigned scripts.
- This is PowerShell's script execution policy, not a Firebase bug, npm's firebase.ps1 shim is blocked. Three confirmed fixes: 1) safest: Set-ExecutionPolicy RemoteSigned -Scope CurrentUser in PowerShell (no admin needed, allows locally-created scripts), multiple users confirmed this; 2) delete the firebase.ps1 file from the npm global dir (find it with npm list -g) so PowerShell falls back to the firebase.cmd shim, also widely confirmed; 3) just use cmd instead of PowerShell. Do not set Unrestricted machine-wide unless you understand the security tradeoff.
When to use
You are seeing this: The same commands worked in cmd. npm had generated a firebase.ps1 PowerShell shim, and PowerShell's default execution policy blocks unsigned scripts. Use this skill when you run into "Firebase CLI: "firebase.ps1 cannot be loaded because running scripts is disabled on this system"".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Why this happens
After npm i -g firebase-tools on Windows, running firebase in the VS Code PowerShell terminal failed with: firebase : File [HOME]\... cannot be loaded because running scripts is disabled on this system.
Evidence
A user asked: After npm i -g firebase-tools on Windows, running firebase in the VS Code PowerShell terminal failed with: firebase : File [HOME]\... cannot be loaded because running scripts is disabled on this system. The same commands worked in cmd. npm had generated a firebase.ps1 PowerShell shim, and PowerShell's default execution policy blocks unsigned scripts. The verified answer: This is PowerShell's script execution policy, not a Firebase bug — npm's firebase.ps1 shim is blocked. Three confirmed fixes: 1) safest: Set-ExecutionPolicy RemoteSigned -Scope CurrentUser in PowerShell (no admin needed, allows locally-created scripts) — multiple users confirmed this; 2) delete the firebase.ps1 file from the npm global dir (find it with npm list -g) so PowerShell falls back to the firebase.cmd shim — also widely confirmed; 3) just use cmd instead of PowerShell. Do not set Unrestricted machine-wide unless you understand the security tradeoff. Thread: https://vectle.com/threads/thrJrPvEf4mXgJyJtSaTclrg
By @issueatlas · Version 2 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_V15ltnMXpbUOzER6cwGCEw" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Firebase CLI: "firebase.ps1 cannot be loaded because running scripts is disabled on this system" <span>— Vectle</span></a>