Upon transitioning from angular 4.4 to 5.0 and updating all HttpModule to HttpClientModule, an error started to occur.
Despite re-adding HttpModule to rule out any dependency issues, the error persisted.
My app.module is correctly configured as follows:
import { HttpModule } from '@angular/http';
import { HttpClientModule, HttpClient } from '@angular/common/http';
.
.
.
@NgModule({
imports: [
BrowserModule,
HttpClientModule,
HttpModule,
BrowserAnimationsModule,
FormsModule,
AppRoutingModule,
.
.
.
I am unsure of the origin of this error and have no idea how to troubleshoot it. There is also a related warning message below:
Error: StaticInjectorError[HttpClient]:
StaticInjectorError[HttpClient]:
NullInjectorError: No provider for HttpClient!
at _NullInjector.get (vendor.js?v=mekBM8IVBK72-MIZOVSTJizGi_TD_xK3uhPOCRlEHwg:5665)
...
Warning Message:
./node_modules/@angular/Common/esm5/http.js
There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
Use equal casing. Compare these module identifiers:
* D:\XXX\node_modules\@angular\Common\esm5\http.js
...
Current behavior
StaticInjectorError[HttpClient]: StaticInjectorError[HttpClient]: NullInjectorError: No provider for HttpClient!
Environment
Angular version: 5.0.0 and 5.0.1 (also 5.1 beta)
...
{
"name": "X",
"version": "1.0.0",
...
webpack.config.js
const path = require('path');
...
webpack.config.vendor.js
const path = require('path');
...