question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

NullInjectorError: No provider for Http!

See original GitHub issue

Upgraded some libraries and now i get this error:

StaticInjectorError[Http]:
  StaticInjectorError[Http]:
    NullInjectorError: No provider for Http!

here’s my app.module.js, you’ll see that NativeScriptHttpModule is imported as expected:

import {NgModule, NO_ERRORS_SCHEMA} from "@angular/core";
import {NativeScriptModule} from "nativescript-angular/nativescript.module";
import {NativeScriptFormsModule} from "nativescript-angular/forms";
import {NativeScriptHttpModule} from "nativescript-angular/http";

import {
  DeviceService,
  DirectionsService,
  ParamsService,
  ShuttleRideService,
  ShuttleService,
  StationService
} from "@suna/quickride-ts-libcore";

import {
  ActionBarLarge,
  AppRoutingModule,
  ConnectionInfo,
  ConnectivityService,
  EnRoutePage,
  LocationService,
  LoginPage,
  NotificationHandler,
  RideListItem,
  RideListPage,
  RouterData,
  ShuttleListItem,
  ShuttleListPage,
  TaskPage
} from "./quickride";

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

@NgModule({
  bootstrap: [AppComponent],
  imports: [
    NativeScriptModule,
    NativeScriptFormsModule,
    NativeScriptHttpModule,
    AppRoutingModule
  ],
  declarations: [
    ActionBarLarge,
    RideListItem,
    ShuttleListItem,
    NotificationHandler,
    ConnectionInfo,
    AppComponent,
    LoginPage,
    ShuttleListPage,
    RideListPage,
    EnRoutePage,
    TaskPage
  ],
  providers: [
    RouterData,
    DirectionsService,
    ShuttleService,
    ShuttleRideService,
    StationService,
    DeviceService,
    LocationService,
    ConnectivityService,
    ParamsService
  ],
  schemas: [
    NO_ERRORS_SCHEMA
  ]
})
export class AppModule {

}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
tsonevncommented, Nov 7, 2019

Hi @briandilley, Could you try replacing the old nativescript-angular/http module with the nativescript-angular/http-client? The http-client is introduced with the latest versions of Angular and it is upgraded version of http. More about it could be found here in the Angular docs.

Also, you could review our example here where it is used the http-client module.

In case the problem still persists, please provide sample project, which could be debugged locally.

1reaction
tsonevncommented, Nov 8, 2019

Hi @WrightTrae, You can find the example here

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular EXCEPTION: No provider for Http - Stack Overflow
Ideally, you split up this code in two separate files. For further information read: ... and include the http class in providers section,...
Read more >
Angular EXCEPTION: No Provider For Http! Error Fix
To avoid Angular EXCEPTION: No provider for Http! error we need to import HttpClientModule from @angular/common/http.
Read more >
Fixing NullInjectorError: No provider for HttpClient - Upmostly
This is such a simple error but one that catches me out on every single new project it seems. The full error is...
Read more >
Ionic v4 : NullInjectorError: No provider for HTTP!
i am new to ionic and i want to use a service for retrieving data from the REST API but i get this...
Read more >
No provider for HttpClient | Edureka Community
I also updated all HttpModule and Http to HttpClientModule. ... StaticInjectorError[HttpClient]: NullInjectorError: No provider for ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found