简体   繁体   中英

Cannot find module @angular/common/http Ionic 3 app

I have done the Ionic 3 app's internationalization using ngx-translate .It gave me below error.

I have done that using official doc here .

Cannot find module '@angular/common/http'

在此处输入图片说明

The issue was @angular/common/http is only available in angular 4.3+ .But on Ionic 3 we're using Angular 4.1.3 .

So this is the solution:

I have removed @ngx-translate/http-loader

npm uninstall @ngx-translate/http-loader --save

And add an older version of it:

npm i @ngx-translate/http-loader@0.1.0 --save

You can read more about it on Git

HttpClient was introduced in Angular 4.3.0 , you are using 4.1.3.

In the Angular version you are using you can inject Http (requires HttpModule in imports: [...] of AppModule ), but it has different features and a different API.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM