question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

npm i -g firebase-tools leads to ...firebase.ps1 cannot be loaded because running scripts is disabled on this system

See original GitHub issue

I’ve come across the following error today after updating firebase-tools. I use Visual Studio Code and after the latest firebase update I’m not able to run any firebase scripts in the PowerShell terminal. I can run them in cmd and I can run other scripts still in PowerShell, eg npm and Netlify hosting. I was using firebase in one project after deploying earlier today, got the prompt to update firebase-tools, did so, and now cant access firebase in any project from PowerShell. Been using without issue for 6+months.

[REQUIRED] Environment info

  • firebase-tools@7.2.4

// Can’t run this command but package.json says: “firebase”: “^5.11.1”,

Platform: Windows 10 Home

[REQUIRED] Test case

  1. Install Visual Studio Code
  2. Open a new file/folder
  3. In terminal - npm install -g firebase-tools
  4. In PowerShell terminal - firebase // followed by any command leads to error : firebase : File C:\Users\mada7\AppData\Roaming\npm\firebase.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.

[REQUIRED] Steps to reproduce

As above

[REQUIRED] Expected behavior

firebase to run scripts in powershell, which worked until updating firebase-tools to the latest version.

[REQUIRED] Actual behavior

// can’t run with --debug flag in Powershell PS C:\web-dev\cv> firebase firebase : File C:\Users\mada7\AppData\Roaming\npm\firebase.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

  • firebase
  •   + CategoryInfo          : SecurityError: (:) [], PSSecurityException
      + FullyQualifiedErrorId : UnauthorizedAccess
    
    

// running in cmd Microsoft Windows [Version 10.0.18362.295] © 2019 Microsoft Corporation. All rights reserved.

C:\web-dev\cv>firebase --debug [2019-08-27T08:50:01.286Z] ---------------------------------------------------------------------- [2019-08-27T08:50:01.290Z] Command: C:\Program Files\nodejs\node.exe C:\Users\mada7\AppData\Roaming\npm\node_modules\firebase-tools\lib\bin\firebase.js --debug [2019-08-27T08:50:01.291Z] CLI Version: 7.2.4 [2019-08-27T08:50:01.291Z] Platform: win32 [2019-08-27T08:50:01.292Z] Node Version: v10.16.3 [2019-08-27T08:50:01.293Z] Time: Tue Aug 27 2019 09:50:01 GMT+0100 (British Summer Time) [2019-08-27T08:50:01.293Z] ----------------------------------------------------------------------

Usage: firebase [options] [command]

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:17
  • Comments:68 (2 by maintainers)

github_iconTop GitHub Comments

273reactions
jwvcommented, Aug 28, 2019

I have the same error. Temp solution: Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser

114reactions
rajachennupaticommented, Nov 14, 2019

Remove ng.ps1(respective ps1 file) from the directory C:\Users< username >\AppData\Roaming\npm\ then try clearing the npm cache at C:\Users< username >\AppData\Roaming\npm-cache..

this worked for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

"Firebase cannot be loading because running scripts is ...
I would not recommend bypassing the execution policy on PowerShell, as it makes your system more vulnerable to malicious scripts. Instead, ...
Read more >
firebase.ps1 cannot be loaded because running ... - You.com
ps1 file), sometimes you can get the cannot be loaded because running scripts is disabled on this system message. It is not an...
Read more >
How To Fix Error PS1 Can Not Be Loaded Because Running ...
This error occurs when your system has disabled the running script and your system is can't accept the ng commands. This error occurs...
Read more >
Install, configure and integrate Local Emulator Suite - Firebase
Import data saved using the --export-on-exit startup option or the emulators:export command to a running Authentication, Cloud Firestore, Realtime Database or ...
Read more >
Fix for PowerShell Script cannot be loaded because running ...
This is due to the Windows PowerShell execution policy being set to prevent untrusted scripts which can affect your Windows client environment.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found