No provider for t! white screen, ionic run android

Been spending all day on getting my project running on a device to no success. When I try to emulate or run on a device I keep getting an error:

0    393964   error    Uncaught Error: No provider for t!, http://192.168.0.24:8100/build/main.js, Line: 6

Both the android device and my machine are on the same network. Also, I am using ts lint and all my passes test so i doubt it is a syntax error. This is not a very helpful error message… Has anyone had this error or know what to look for so I can get this running on a device? Thanks in advance.

I have the same problem, on Beta 11 no problem (browser, android, ios), on RC0 white screen of death (on android), ionic serve is working though:(

Are you sure that you don’t have ANY build errors? No provider for t sounds like a dependency injection failure btw

Not the solution, but for the record, @almighty99 has the same error trying to register is own back action…if that could help

You are right, my mistake, I don’t know how I missed the errors, but after fixing them, all is fine:)

yup, Injecting anything into the constructor of app.componet.ts except platform gives that exception

I am still getting the same error message after confirming I have no build errors after running ionic build or ionic build android. And I have removed all injections from app.component.ts’s constructor, except for platform. Not sure whats going on here. Here is my app.component.ts:

import {Component, ViewChild} from '@angular/core';
import {Platform, Nav} from 'ionic-angular';
import {StatusBar} from 'ionic-native';

import ...

@Component({
    templateUrl: 'app.component.html'
})

export class AppComponent {
    @ViewChild(Nav) nav: Nav;

    rootPage = HomeComponent;

    constructor(public platform: Platform) {
        this.initializeApp();
    }

    initializeApp() {
        this.platform.ready().then(() => {
            // Okay, so the platform is ready and our plugins are available.
            // Here you can do any higher level native things you might need.
            StatusBar.styleDefault();
        });
    }
}

And what does your App Module ts look like?

app.module.ts:

import {NgModule} from '@angular/core';

import {IonicApp, IonicModule} from 'ionic-angular';

import {AppComponent} from './app.component';
import ...

@NgModule({
    declarations: [
        AppComponent,
        HomeComponent,
        AboutComponent,
        TopNavComponent,
        CardControlComponent,
        SelectWicProviderComponent,
        KeyEnterUPCComponent,
        WicRegisterCardComponent,
        ManageCardsComponent,
        WebViewComponent,
        ItemDetailPageComponent,
        ItemDetailListComponent,
        BenefitsPageComponent,
        PartnersComponent,
        SettingsComponent,
        ViewWicVendorsComponent,
        WicVendorDetailComponent,
        WicVendorFavoritesComponent,
        WicVendorListComponent,
        VendorTabsComponent,
        WicOfficeListComponent,
        WicOfficeDetailComponent,
        WicOfficeViewComponent,
        OfficeTabsComponent
    ],
    imports: [
        IonicModule.forRoot(AppComponent)
    ],
    bootstrap: [IonicApp],
    entryComponents: [
        AppComponent,
        HomeComponent,
        AboutComponent,
        SelectWicProviderComponent,
        KeyEnterUPCComponent,
        WicRegisterCardComponent,
        ManageCardsComponent,
        WebViewComponent,
        ItemDetailPageComponent,
        BenefitsPageComponent,
        ItemDetailListComponent,
        PartnersComponent,
        ViewWicVendorsComponent,
        WicVendorDetailComponent,
        WicVendorFavoritesComponent,
        WicVendorListComponent,
        VendorTabsComponent,
        SettingsComponent,
        WicOfficeListComponent,
        WicOfficeDetailComponent,
        WicOfficeViewComponent,
        OfficeTabsComponent
    ],
    providers: [CookieService, SessionService, RestService, XML2JSON]
})
export class AppModule {
}

And you have no problem running ionic serve? I’m still convinced you’re missing a dependency injection somewhere, maybe in one of the components. Do you have any issues while linting and stuff like that?

Yes I am able to run ionic serve and everything works. No issues with linting. And what do you mean by missing a dependency injection? Also, why is that when I start a fresh new project with ionic start MyIonic2Project tutorial --v2
I am able to run ionic emulate android just fine even though there is more than just platform being injected into the app component’s constructor? I am starting to think that the ‘no provider for t!’ exception can be ambiguous.

Yes, it’s definitely ambiguous, but this error usually points in the direction of missing a dependency injection somewhere in your project. For example if you forget to import a component somewhere while you’re using it, it means you’re missing a dependency injection. The fact that everything works fine with a brand new project means that something in your project causes the error and that it probably isn’t due to an environment variable. These errors are very hard to reproduce, that’s a pitty i guess. If you compare your setup to the newly created project there aren’t any differences either I suppose?

Turns out that you cannot use CookieService in an ionic app, which was giving me that exception. Instead you have to use NativeStorage. This project is being ported over from a web project to ionic so I had to work some kinks out after I removed that but after that the project emulated fine on a device. Thanks for the help, you definitely lead me in the right direction.

Glad you solved it! These errors are hard to find. A better descriptive error should give you more lead in the right direction I guess

Check your main.prod.ts file, I think you are updated this file. You can replace your file with the following code.
import { platformBrowser } from ‘@angular/platform-browser’;
import { enableProdMode } from ‘@angular/core’;

import { AppModuleNgFactory } from ‘./app.module.ngfactory’;

enableProdMode();
platformBrowser().bootstrapModuleFactory(AppModuleNgFactory);

I’m struggling with this same problem.

I’m using “LocalStorage” and not a “CookieService”

LocalStorage was available on beta11. Has this also changed?

What’s exactly the error you get?

Otherwise, have you tried Localforage? Works for me

I am just using:

import {Storage} from '@ionic/storage';

providers: [Storage, ....]

And works great for web and devices.

I have this exact same error after updating to Ionic 3.
It happens only with minified code (after running ionic cordova run android --prod so a bit hard to debug. I have no build errors. Any suggestions would be appreciated :slight_smile:

Try to run without --prod but with --dev instead. Probably the error won’t get obfuscated.