Ng Deploy Publishes a Non-Working Page

I was able to compile my firebase app using “ng serve” with no errors but then when I deployed my app with “ng deploy”, the app just didn’t work. There are no error messages so I don’t know how to fix it. This is a firebase app.

When using the angular-cli using ng serve doesn’t actually build the app. It only partially builds its and runs it using a development server. Use npm run build to create files you want to deploy then run npm run deploy.

More docs on the overall process of what your doing is here from the official Angular docs:
https://angular.io/start/start-deployment#hosting-an-angular-app-on-firebase

I ran firebase init and selected all of the defaults and then I got errors when I tried ng deploy again.
So I tried what you suggested and ran npm run deploy and I got the error:

npm ERR! missing script: deploy

Sorry you can run it via ng deploy, rather than npm run deploy. The npm run is just part of npm to run scripts. By default a lot of the ng commands are set as npm scripts, except the deploy one you have to add manually. (look into package.json to see the other npm run scripts and add a deploy one if you want)

It doesn’t work for ng deploy either. I get the error:

C:\Users\Maureen\Desktop\udemy\mosh\cart\node_modules\rxjs\internal\util\hostReportError.js:4
setTimeout(function () { throw err; }, 0);
^
TypeError: entry.message.split is not a function

The errors are all a result of my running firebase init and selecting all the defaults. The ng deploy command worked before I ran firebase init.

Yea that error could be anything, I’d dig further into it to see if you can find what is related to it and get more specific help for it. Or just turn stuff on/off until you isolate the exact issue

I don’t understand what you mean. What can I turn on and off in order to isolate the issue?

Thank you, bradtaniguchi, for all of your insights

You selected all the defaults when running firebase init, this turned on a bunch of stuff. You could try to turn off some of those features to see if they help. If you aren’t sure how to do that, then I just wouldn’t worry about it and hope what you did turn on isn’t breaking.

After some quick googling on the error message I found this:

I’d try that fix, and if you run into more issues google around, as odds are whatever errors you run into someone else probably already did aswell :slight_smile:

Good luck!

I deleted firebase.json and .firebaserc and then ran ng add @angular/fire and then ng deploy worked again but it’s still deploying a non-working app.

I ran ng deploy again and now I get the error:

Error when trying to deploy:
Cannot select firebase project ‘cart-64d3f’

I ran firebase projects:list and then selected the id to use firebase deploy --project cart-64d3f but it deployed a blank page.

ng deploy is working now but it still produces a non-working app even though there are no errors when I run ng serve.

Still no errors but now I get a blank page when I go to my app.

Id say the issues you are facing could be from any little config issue. Id recommend providing a github repo if you have one. If you can’t do this, then you have to google around to see if you can find some solutions to what your seeing.

So far it seems like your trying to deploy your app without sufficient knowledge of knowing how the deployment works, or how to debug a given deployment with Angular. Id recommend taking a pause and identifying which part of this process you understand and don’t understand and look into those more in depth.

As even from the beginning, you asked for help with ng deploy, which to those not accustom is a very specific deployment method provided by Angular. There was no mention of anything beyond firebase. Luckily I knew exactly what you were doing as I’ve done it myself a few times when trying out those technologies.

So yes, take a step back, look into the technologies you are using, and see if you can find the little config issue that is currently affecting you, and or provide your source if possible so others can help look into the issue aswell (if they can).

Good luck!

My code is at https://github.com/makamo66/angular-shopping-cart/tree/master

Er where is the rest of the Angular app? The repo has only 2 files in it for 1 component.

If your deploying and getting a blank page, the issue is with the build/deployment. Providing 1 component wont be enough to fix the problem :frowning:

At this point I probably wont be able to help you must further unfortunately. I again recommend taking a pause and diving deeper into the technologies you are using. I primarily recommend this as using Firebase+Angular is not easy. Both include and require a significant knowledge of app development with knowledge of:

Along with knowledge of the tooling your using:

And knowing how Firebase hosting/apis work regardless of what tooling/frameworks your using:

Hopefully with these resources you can learn what you need to get this going. I recommend going further as getting this deployed is only the first step in a long process of building a production grade Firebase app, only more knowledge will be needed.

I unfortunately wont be able to guide you through the entire process, but believe you will be able to make it through on your own after getting up to speed with all of what you want to use.

So Good luck, keep building :slight_smile:

Thanks bradtaniguchi

My app still doesn’t work but I am getting error messages in the developer console now.