I design websites in VSC and PowerShell is my default terminal.
After updating and deploying a website to firebase earlier, I was prompted to update firebase tools - which I did using npm. Immediately after I cannot run/access any firebase scripts wthout the folllowing 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. At line:1 char:1
firebase
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
I've spent a few hours searching around and can't find a solid answer the problem. Many threads are several years old and I find it bizarre I've not had this problem in the past year until today. I can still access firebase scripts if I set my default terminal to cmd.
Assuming the problem was related to firebase-tools I've carried on working but have now updated vue.js and get the error again when trying to run any vue commands in powershell:
vue : File C:\Users\mada7\AppData\Roaming\npm\vue.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
vue
+ CategoryInfo : SecurityError: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
VSCode Version:
Version: 1.37.1 (user setup)
Commit: f06011a
Date: 2019-08-15T16:17:55.855Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.18362
OS Version:
Windows 10 Home
Version - 1903
OS build - 18362.295
I've been reading around and seen many threads around permissions for scripts, but I haven't changed any - indeed the PowerShell scripts worked right up until I updated my packages. No other settings touched in the mean time. I don't want to be changing PowerShell settings unnecessarily.
ps1 cannot be loaded because running scripts is disabled on this system" occurs when the execution policy does not allow running the specific script on Windows. Use the Set-ExecutionPolicy -ExecutionPolicy RemoteSigned command to solve the error.
vue : File C:\Users\{USER_PROFILE}\AppData\Roaming\npm\vue. ps1 cannot be loaded because running scripts is disabled on this system. Simply go to the file (vue. ps1) and delete it.
While running PowerShell script, if you get running scripts is disabled on this system, it is because the PowerShell execution policy is set up by default as Restricted and doesn't allow to run script. PowerShell has built-in security features implemented.
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"
}
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"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With