Skip to content
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

15. Deploy your web app to Firebase Hosting #9

Open
AndreSand opened this issue Dec 3, 2020 · 7 comments
Open

15. Deploy your web app to Firebase Hosting #9

AndreSand opened this issue Dec 3, 2020 · 7 comments

Comments

@AndreSand
Copy link

Hi, it looks like in the CodeLab: Multi-platform Firestore Flutter, step 15 is missing this command firebase init hosting.

https://codelabs.developers.google.com/codelabs/friendlyeats-flutter?hl=en&continue=https%3A%2F%2Fcodelabs.developers.google.com%2F%3Fcat%3Dflutter#14

Commands:

  1. flutter build web
  2. firebase init hosting
    3. firebase deploy --only hosting

If we don't run the command firebase init hosting we get the below error:

Target dart2js failed: Exception: Error: FileSystemException: Cannot open file, path =
--
/Users/asandoval/dev/flutter/friendlyeats-flutter/.dart_tool/flutter_build/ed4fd20d65140e369640cdfbaae21d2e/app.dill
(OS Error: No such file or directory, errno = 2)

Thanks,
Andres

@megataps
Copy link

megataps commented Dec 7, 2020

Thanks @AndreSand. You saved the day.

@ditman
Copy link
Member

ditman commented Dec 17, 2020

This is a very good point @AndreSand, thanks for reporting! There's a new process for publishing codelabs that I need to look into, but I'll add the firebase init hosting command ASAP.

In the meantime, I'll leave this issue open so others can find it.

@pingbird
Copy link

I suspect the firebase.json is missing an extra &, causing both the clean and build commands to run concurrently:

"predeploy": "flutter clean & flutter build web",

@AndreSand
Copy link
Author

@megataps @ditman Thank you for creating the CodeLab tutorial! I was able to follow the tutorial to create this demo app: https://happy-hour-san-jose.web.app/#/

@pescamillam
Copy link

Thank you @AndreSand indeed they are missing that step, I also see some errors like they mention develop section where it should be Build and database where it should be Cloud Firestore, thanks for reporting this, I wonder why they haven't updated it

@domesticmouse
Copy link

Thanks for the report. An update is in progress.

@j-vasil
Copy link

j-vasil commented Apr 14, 2021

I had a difficult time getting this step working. This surprised me because when I ran the Firebase web codelab "Friendly Chat" last week, deploying the app went very smoothly. Anyhow, I think the main issue was my answers to the 'firebase init hosting' prompts. I tried several different things for the "public directory" directory and only after comparing my directory tree to the 'done' branch did I realize that the 'build' dir was built during the deployment. Anyhow, here are the details of what I did to get it working in case it helps others or is deemed worthy of being added to the instructions:

**\friendlyeats-flutter2> flutter clean # Suggested by earlier comments in this issue (9)
**\friendlyeats-flutter2> flutter build web
Building without sound null safety # See issue 15
**\friendlyeats-flutter2> firebase init hosting
? Are you ready to proceed? (Y/n) y
? What do you want to use as your public directory? (public) build\web # <- The ans I got wrong multiple times!
? Configure as a single-page app (rewrite all urls to /index.html)? (y/N) n
? Set up automatic builds and deploys with GitHub? (y/N) n
? File build\web/404.html already exists. Overwrite? (y/N) y # Odd since I did a 'flutter clean'. Maybe n would have worked too?
? File build\web/index.html already exists. Overwrite? (y/N) n
**\friendlyeats-flutter2> firebase deploy --only hosting

Any suggestions for the proper answer to the two 'overwrite?' questions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants