I have installed the firebase tools, however whenever I try to initialize it in my rootfolder, using the terminal from Vscode, I receive the following error. Why is that?
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
Install firebase globally
npm i -g firebase
and then,
firebase login
firebase init
TLDR: Just delete your firebase.ps1 file and try again
I would not recommend bypassing the execution policy on PowerShell, as it makes your system more vulnerable to malicious scripts.
Instead, simply delete the firebase.ps1 file at the location indicated by the error message and try running the command again.
Note: in case the above doesn't work, you might need to clear your npm cache by running npm cache clean --force.
Source: https://stackoverflow.com/a/54776674/1536286
Run the following at the terminal in VS Code (make sure the app is run with the option Running as Administrator as suggested by #MaylorTaylor)
Set-ExecutionPolicy RemoteSigned
Then run the script in that same console.
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
This worked for me
Open Windows Power Shell as Administrator and then run the below command to change Execution Policy setting to RemoteSigned
Set-ExecutionPolicy RemoteSigned
Now change directory to your project folder and run the following
firebase login
firebase init
Close cmd and powershell and VS Code.
Then right click on VS code---RunAs Administrator
and in the VS Code Terminal run the following command:
Set-ExecutionPolicy Unrestricted
Then in the same VS Code cmd run:
firebase login
firebase init
This should solve your problem.
Windows now comes with an extra layer of security to protect your OS environment from random scripts running in the background without admin privilege's.
Most Random Scripts(From browser engines on unverified sites and applications) are also bad for your OS,unless you are running them yourself as an admin or as a developer,provided you know what you are doing.
Firebase scripts are pretty safe.
Set-ExecutionPolicy -Scope Process -ExecutionPolicy Bypass
Run this in your current working directory, i.e where Firebase is initialized and run this command, worked for me.
If using VScode, installing the PowerShell extension by Microsoft will solve this issue.
enter link description here
Instead of setting Execution Policy. I ran windows terminal as administrator instead of VS code terminal and execute command without an issue.
Simply in VScode switch from PowerShell to cmd
and type this command.
firebase login
And you will be redirected to your browser to allow Firebase CLI to access the account connected to your firebase project and then type this command.
firebase init
That should work
In cmd it works
firebase login
firebase init
Select project
The solution for me: is that i am using Windows 11 and i used to use Windows Power Shell instead of Command Prompt
In case want to use Windows Power Shell you have to run this cmd first:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Related
I am trying to set up auto-deployment from GitHub to AWS, using EC2.
I set Role with CodeDeployServiceRole auto policy
After following the Tutorial: Use AWS CodeDeploy to Deploy an Application from GitHub, my deployment fails at the ApplicationStop event, after trying for couple of minutes with error code HEALTH_CONSTRAINT. I'm not sure how to troubleshoot the issue/where to look.
These are few hints of how you can navigate your way
Logs as mentioned in comments in /var/log/aws/codedeploy-agent
As AWS support recommend you can add for one time --ignore-application-stop-failures so it will skip that step in case it failed last time and see، because the application stop Lifecycle event uses the appspec file from the last successful build so if that one is corrupted somehow this step will fail in the following builds
(not recommended) you can delete the file, that CodeDeploy uses to keep track of the previous successful deployment in the following path /opt/codedeploy-agent/deployment-root/deployment-instructions/
Check the latest logs at /var/log/aws/codedeploy-agent
If your deployment is failing at ApplicationStop event, then most likely the issue is your EC2 instance does not have the necessary permissions to get the artifacts from S3 bucket.
Your EC2 instance must have an IAM role attached which gives it enough permissions to download the artifacts from S3 bucket
Your EC2 must be started with an IAM role. So you may have to reboot your instance after attaching the role to it.
From your configuration, looks like you have provided permissions to CodeDeploy to perform certain actions on your EC2. You may want to check if your EC2 also has the necessary permissions to download packages from S3 bucket.
Another reason for this error is that the CodeDeploy Service is not running on your machine. On Windows machines, Code Deploy Service terminates sometimes, and as a result, the deployment is not downloaded on the machine. Nothing appears in the logs either.
Run services.msc and check the code deploy agent service. If it is not running, start it and retry the deployment.
I had the same issue and solved it by solving codedeploy-agent that wasn't working on my EC2 instance.
sudo service {httpd/apache2} status
Something might have cause the agent not to run properly
Hope it will help
I had the same issue. You also need to make sure that your EC2 instance has code-deploy-agent installed.
Follow the below aws guide. It worked for me.
AWS guide to install code agent in linux server
Check if the codedeploy-agent is running.
sudo service codedeploy-agent status
if not running then use below command to run
sudo service codedeploy-agent start
If you are using aws Windows server, check the logs at :
C:\ProgramData\Amazon\CodeDeploy\log\codedeploy-agent-log.txt
AWS Docs
To check if the codedeployagent running in windows. Open powersheel command window and run these command.
powershell.exe -Command Get-Service -Name codedeployagent
Better to stop and start again.
powershell.exe -Command Stop-Service -Name codedeployagent
powershell.exe -Command Start-Service -Name codedeployagent
Or Restarting also works
powershell.exe -Command Restart-Service -Name codedeployagent
For me I had to uninstall the codedeployagent on windows by uninstalling and deleting old files of codedeploy.
Run the below command in powershell one by one to uninstall.
wmic
product where name="CodeDeploy Host Agent" call uninstall /nointeractive
exit
After this delete the codedeploy folder at this location.
C:\ProgramData/Amazon/CodeDeploy/
Now install codedeployagent on windows.
Start the codedeployagent again.
powershell.exe -Command Start-Service -Name codedeployagent
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.
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"
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
I didn't have any problem with npm but the same problem is in the using yarn on windows.
In my case, I deleted yarn.ps1 and it worked fine for me:
File path:
C:\Users\<your account>\AppData\Roaming\npm\yarn.ps1
This could be due to the current user having an undefined ExecutionPolicy.
You could try the following
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted
For those who work with VS Code and get the about_Execution_Policies error. In my case with the command ncu -u (npm-check-updates).
Try it with CMD:
Simply execute the command in CMD again.
If this works, the security settings can remain as they are.
search for powershell
right click and run as administration
run this simple command Set-ExecutionPolicy RemoteSigned
Press A And Enter
go to code and run yarn add <YOUR_MODULE>
press Enter.
congratulations now it would be done.
I also had this problem in the powershell and i used the following :
then i again installed the serve package.
Set-ExecutionPolicy -Scope CurrentUser
and then i chose Unrestricted and gave serve command and it worked.
File C:\Users\xxxx\AppData\Roaming\npm\vue.ps1 cannot be loaded because running scripts is disabled on this system.
I had the same error message with vue.
After running the below command successfully
npm install -g #vue/cli
when i ran commands like vue or vue --version, i received that error message.
This is how i fixed it:
I pressed the buttons windows + E, clicked view, checked hidden items.
Then, i went to C:\Users\xxxx\AppData\Roaming\npm folder and deleted the vue file of type 'windows powershell script'.
After that, i ran the commands vue and vue --version succesfully.
Hope this helps.
Instead of using PowerShell and changing its security settings, you can simply use cmd instead. It will not give an error and your all commands will run smoothly.
Remember PowerShell is stronger and sensitive. So, Microsoft by default disables running .ps1 files as it can cause a security issue and harm your pc. So, that's why you should try to use cmd instead of changing PowerShell security.
Open Powershell from your VS code and then execute this command on that:
set-ExecutionPolicy RemoteSigned -Scope CurrentUser
this worked for me. it will ask you for CLI authentication.
Open Powershell and execute this command:
set-ExecutionPolicy RemoteSigned -Scope CurrentUser
Delete firebase.ps1 located in:
C:\Users\<your account>\AppData\Roaming\npm\
In case you don't have firebase.ps1 delete vue.ps1
If you have this issue in VS Code, close PowerShell terminal and open a Command Prompt terminal instead.
PS C:\> Set-ExecutionPolicy RemoteSigned
It's works for me
I don't know if it can help with Firebase but I had a similar problem installing Vue with *>npm install -g #vue/cli* .
Long story short:
I deleted vue.ps1 from C:\Users\XXX\AppData\Roaming\npm\ and installed it locally (without -g) from powershell terminal inside VsCode *>npm install #vue/cli*.
After that I could use Vue commands without problems.
Just delete Power Shell file:
C:\Users\<your account>\AppData\Roaming\npm\**vue**
Delete this last vue file, extension of this file is power shall
after delete run command it's work.
On a computer with German as the default language the error might look like:
vue : Die Datei "C:\Program Files\nodejs\vue.ps1" kann nicht geladen werden, da die Ausführung von Skripts auf diesem System deaktiviert ist. Weitere Informationen finden Sie unter "about_Execution_Policies"
(https:/go.microsoft.com/fwlink/?LinkID=135170).
In Zeile:1 Zeichen:1
+ vue --version
+ ~~~
+ CategoryInfo : Sicherheitsfehler: (:) [], PSSecurityException
+ FullyQualifiedErrorId : UnauthorizedAccess
I had to search for "vue" "PSSecurityException" to find this thread.
I installed a new node version with nvm-windows. Then I installed vue-cli. After that a simple vue --version led to the error above.
It seems like the removal of the vue.ps1 file helped to resolve my problem like some users suggested above.
I had a similar issue during installation of grunt and yarn.
"yarn : File C:\AppData\Roaming\npm\yarn.ps1 cannot be loaded. The file C:\AppData\Roaming\npm\yarn.ps1 is not digitally signed. You cannot run this script on the current system. For more information about running scripts and
setting execution policy, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170."
When I checked the AppData\Roaming\npm* folder, I could see grunt script being generated as:
Windows Command Script
Windows Powershell Script
Upon deletion of the powershell script, the error was gone.
Just open cmd as administrator and go to your project
then execute your firebase command
I am following a tutorial on Ionic Angular and it has come to the point where the instructor is having me publish my code to Firebase Hosting. First I used NPM to install the Firebase CLI. Then I was instructed to use the firebase init command. The issue is that the CLI doesn't seem to recognize the current directory that is selected in my terminal.
I run: cd /Users/MyUserName/myProjectsFolder/myProject/
Then I run firebase init and it displays:
You're about to initialize a Firebase project in this directory:
/Users/MyUserName
When I would expect it to read:
You're about to initialize a Firebase project in this directory:
/Users/MyUserName/myProjectsFolder/myProject
A little bit of googling found this page:
https://firebase.google.com/docs/cli/
Which includes this passage:
To initialize a new project directory, change directories in the terminal to your desired project directory and run: firebase init
Based on this I would expect the steps I took to work.
I am confused. Has anyone ever run into this behavior? Can anyone think of a way to get the CLI to function as expected?
Thanks.
Got to folder:
/Users/Username/
Search for a file with name of firebase.json and Delete it.
Reinstall firebase tool with this command (--unsafeper- to avoid
permissions error messages & use sudo):
$ sudo npm install --unsafeper- -g firebase-tools
Then, go to your pubilc folder (you have to create one) which
contains your HTML, JS, images and CSS files and use this command:
$ sudo firebase init
$ sudo firebase deploy
The reset is easy and as mentioned in the firebase
docs:
https://firebase.google.com/docs/hosting/quickstart
The reason is that you must have initiliazed a project in some parent directory (of this myProject folder) in the past. Somehow firebase sees that project in that directory rather than initializing a new project in the current path.
Solution:
Check the parent directories of the path where you want to initialize a firebase project now. Delete / Move the firebase files from that folder and then you should be able to initialize a project in the current directory.
For example:
I also faced the same problem.
I was trying to initialize a project in this path:
D:\Work\Projects\myProject
But somehow it always got initialized in this path:
D:\Work
After some searching it turned out that the reason was that I had initialized a project in
D:\Work directory. I moved those files to another folder and that solved the problem.
I was also facing this problem and windows not able to recognize the firebase. I don't know the exact reason why it was behaving in such a manner but it solved the problem.
1) I installed the firebase-tools using a command on command prompt
npm install -g firebase-tools
and it didn't work.
2) I restarted the machine.
3) then again I executed the same command from step 1) npm install -g firebase-tools
and it worked.
Was trying to do this and discovered a command that allows "firebase" as a command.curl -sL https://firebase.tools | bash This will allow $ firebase login and $ firebase init to work.
I was facing the same issue. After checking the log I figured out that the Authentication token was expired from my firebase cli login session. So I logged out and Logged-In again to the firebase cli using Firebase logout And firebase login command. Problem solved.
To check out your issue go to firebase log using firebase-debug.log command.
And take required steps.
I installed heroku cli on windows 10 via exe installer.
When i try to run heroku --version command or heroku login
command, the command window does not respond. It does not give any error.
Then i uninstalled it and installed it using npm install -g heroku-cli
but getting same result.
Node version - 8.7.0
In Windows cmd prompt, do:
echo %USERPROFILE%
Go to your C:\Users\YOURNAME
Look for a file named:
_netrc
This file stores login credentials. Delete it.
Then check for an update:
heroku update
Then try to log in:
heroku login
I saw some people create an environment variable called HOME and add the path to YOURNAME so the environment knows to look for the _netrc file there.
Other trouble-shooting ideas if the above doesn't work for you can be found at Heroku CLI troubleshooting
In windows , run %LOCALAPPDATA%\heroku, completely delete this folder. and check again on cmd by typing heroku --version. Hope this helps.
I ended up uninstalling heroku from the Windows Installer and instead used the standalone tarball.
You can get the tarballs from here.
After you downloaded and extracted it, you can go to your terminal and cd into the directory where you extracted the file and do the following command:
./bin/heroku --version
Whenever you need the heroku CLI, you can cd into the directory where heroku is, then ./bin/heroku is the executable for heroku.
I am trying to install openstack using devstack on ubuntu 16.04.
I followed the following link.
https://docs.openstack.org/developer/devstack/guides/single-machine.html
When I run
sudo openstack service list
, it prompt the following error.
Missing value auth-url required for auth plugin password
Make sure you are logged into horizon and download the rc file (right corner). After that do source admin-openrc.sh
Note that you have to download the rc file of the project you are working on
This should do. keystonerc_admin file is generated at the end of openstack packstack installation
source keystonerc_admin
always run admin-openrc file before running any openstack command
eg.
$source admin-openrc
then run whatever openstack command you want to run
eg.
$openstack --debug server list
Take rocky version of OpenStack Keystone as an example. https://docs.openstack.org/keystone/rocky/install/keystone-openrc-rdo.html#using-the-scripts
You can create an admin-openrc.sh (If you are installing OpenStack Keystone for the first time.) and put environment params. And source this file before you run any "openstack" command. This resolves the issue.
I put the admin-openrc.sh in directory /usr/share/keystone/admin-openrc.sh for a recommend.