New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Firebase deploy error message with an empty firebase.json #367
Comments
I came here to open some issue similar to this one. IMO it would be better to pre-populate the firebase with the default options. I choose that I wanted to use only hosting the firebase.json should have be created with the default hosting option. {
"hosting": {
"public": "public"
}
} |
Thanks for the feedback @ahaverty ! I agree that the error msg could be a bit more descriptive. It is a bit difficult since the same error also occurs if someone misspelled target names when using the --only flag (e.g. if someone ran "firebase serve --only functions:funcA" and they don't actually have a function called funcA). What do you think about an error message like the following? Error: Cannot understand what targets to deploy. Check that you specified valid targets if you used the --only or --except flag. Otherwise, check your firebase.json to ensure that your project is initialized for the desired features. @pedrosnk "firebase init" should have populated firebase.json with the correct default options. If it didn't, can you file another bug and include detailed instructions for reproducing? |
@laurenzlong That sounds perfect in both cases 👌 |
First of all thank you for you response :) I figured out what happened to me. maybe is the same thing that happened to @ahaverty. I typed It was entirely my mistake, but I fell like this mistake could be avoid. Maybe if I press enter into a feature the cli should be able to select it to me automatically. instead of generating an empty thanks again for this project. |
Context on my use case: I'm wrapping our Firebase deploy commands in bash scripts with some lovely "Are you sure?🤔" checks, as I'm terrified of one day hitting our production project with some crazy Dev code, after not correctly running |
Agree better error message in this case is good enough |
I agree with @pedrosnk the file should be prepopulated with some default options like:
After all everybody is using an SPA with Firebase Hosting. |
Just sent a PR to fix the error msg. @pedrosnk and @PierBover what if "firebase init" would not let you progress further if you didn't select any features? We can't really populate hosting by default since some people do not actually use it (for example, if they have a mobile app and are using functions). |
Hey @laurenzlong I did select |
@PierBover that's a bug then. When I do 'firebase init' and select hosting, I get this in my firbase.json:
Could you try to reproduce the bug? And if you can reproduce it, then file another issue? (Please include CLI version, platform you're running.) |
Also, you select a feature by pressing space (the circle then becomes filled). If you selected it, then you will be guided through some questions related to hosting (What do you want to use as your public directory? Configure as a single-page app (rewrite all urls to /index.html)?) |
You are right, I probably pressed enter instead of space. My bad. |
No worries! |
Sorry, I'm a newbie and this is the closest discussion to the error I am seeing. On firebase init I chose cloud functions and got an empty firebase.json with curly braces. Now deploying gives me "cannot understand what targets to deploy". Is using hosting a prerequisite to using cloud functions? |
Hey @himanshugarg I'm unable to reproduce your bug, you should be able to deploy after just initializing functions. Could you please file a separate issue, and follow the issues template so we can capture more details? |
Thank you! @pedrosnk |
@laurenzlong thanks for checking. It was my fault. I had moved only some of the firebase files to another directory, causing this. Doing a clean init worked nicely. https://stackoverflow.com/questions/45935600/firebase-cannot-understand-what-targets-to-deploy |
In firebase init CLI, one who see brackets ( ) can think it imitate radio button, so chooses an option and hits Enter. I suggest instead square brackets [ ] which suggest multiple-choice (checkboxes). I also had an empty firebase.json file because of pressing Enter and missed Space. |
// Avoid the etra ',' after the sqr bracket unless u have an arg to go there |
I also pressed enter instead of space. I guess it's not a functional issue but is indeed a usability issue |
@lelong88 I belive that would happend the first time to many people. |
firebase is looking by default in folder 'public' for file 'index.html'. if in angular4 for example the 'index.html' exists in folder 'dist' you have to go into 'firebase.json' and paste there: { this is direct the firebase to look for 'index.html' in 'dist' folder or whatever is folder call instead 'public'. after that:
probably will work |
worked for me! |
Space to select features? Are you stoned? |
ahahahah use of a space? LMAO. |
[debug] [2018-06-03T15:18:34.367Z] ---------------------------------------------------------------------- You're about to initialize a Firebase project in this directory: C:\Users\pushpendraPC\Desktop\project\NewAsignMentDeploy\AssignMent\src Before we get started, keep in mind:
[info] Sun Jun 03 2018 20:48:36 GMT+0530 (India Standard Time) |
show error when i run cmd firebase init |
Hi, Page Not Found Why am I seeing this? You can also add a 404.html in the root of your site to replace this page with a custom error page. *******************Command Line ******************** === Deploying to 'organicshop-18573'... i deploying hosting ✔ Deploy complete! { |
type ng build and then type firebase deploy |
firebase bad |
This original issue seems to be addressed. Since there's been no recent activity, I'm going to close this. If anyone has additional issues with |
I have followed the provided solutions but they have not solved my problem. page does not fetch the data, its blank, but the fav icon is loaded. what cold be the issue |
This is the right solution |
I was doing a bit of project merging today and came across an error with the firebase deploy command.
I accidentally left my firebase.json with the contents as:
{}
And was trying to deploy with
firebase deploy --only database
but was getting the following error:Error: No targets found. Valid targets are: database,storage,functions,hosting
It took me awhile to figure out, as I thought this was linked with the recent nodejs v8 issues + the fact that I've been successfully deploying multiple projects for the last 6 months (rules and a separate functions project which had the empty firebase.json) until now.
If the error suggested looking into my firebase.json it would have helped 👍
The text was updated successfully, but these errors were encountered: