I’m receiving the following error when I try to execute ionic serve
:
ERROR TypeError: this.http.get is not a function
at TranslateHttpLoader.getTranslation (http-loader.js:15)
at TranslateService.getTranslation (core.es5.js:3171)
at TranslateService.retrieveTranslations (core.es5.js:3157)
at TranslateService.setDefaultLang (core.es5.js:3098)
at new MyApp (app.component.ts:33)
at createClass (core.js:12449)
at createDirectiveInstance (core.js:12284)
at createViewNodes (core.js:13742)
at createRootView (core.js:13631)
at callWithDebugContext (core.js:15056)
I believe that errors are from this method to translate app, but I couldn’t fix this yet:
export function createTranslateLoader(http: HttpClient): TranslateHttpLoader {
return new TranslateHttpLoader(http, './assets/i18n/', '.json');
}
My package.json configurations:
{
"name": "AppName",
"author": "MyName",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"@angular/animations": "5.2.9",
"@angular/common": "5.2.9",
"@angular/compiler": "5.2.9",
"@angular/compiler-cli": "8.2.12",
"@angular/core": "5.2.9",
"@angular/forms": "5.2.9",
"@angular/http": "5.2.9",
"@angular/platform-browser": "5.2.9",
"@angular/platform-browser-dynamic": "5.2.9",
"@ionic-native/app-version": "^4.1.3",
"@ionic-native/browser-tab": "^4.1.3",
"@ionic-native/camera": "^4.1.3",
"@ionic-native/core": "^4.3.3",
"@ionic-native/crop": "^4.3.3",
"@ionic-native/facebook": "^4.1.3",
"@ionic-native/file": "^4.1.3",
"@ionic-native/geolocation": "^4.1.3",
"@ionic-native/google-analytics": "^4.1.3",
"@ionic-native/google-maps": "^4.1.3",
"@ionic-native/google-plus": "^4.1.3",
"@ionic-native/http": "^4.18.0",
"@ionic-native/in-app-browser": "^4.18.0",
"@ionic-native/push": "^4.18.0",
"@ionic-native/social-sharing": "^4.18.0",
"@ionic-native/splash-screen": "^4.1.3",
"@ionic-native/status-bar": "4.5.3",
"@ionic/storage": "^2.1.1",
"@ngx-translate/core": "^9.1.1",
"@ngx-translate/http-loader": "^2.0.1",
"cordova-android": "7.1.4",
"cordova-browser": "^5.0.4",
"cordova-ios": "4.5.5",
"cordova-plugin-advanced-http": "^2.2.0",
"cordova-plugin-app-version": "^0.1.9",
"cordova-plugin-camera": "^4.0.3",
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-console": "^1.1.0",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-facebook4": "^1.10.1",
"cordova-plugin-file": "^6.0.2",
"cordova-plugin-geolocation": "^2.4.3",
"cordova-plugin-google-analytics": "^1.8.6",
"cordova-plugin-googleplus": "^5.3.2",
"cordova-plugin-inappbrowser": "^1.7.2",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.3",
"cordova-plugin-whitelist": "^1.3.3",
"cordova-plugin-wkwebview-engine": "git+https://github.com/driftyco/cordova-plugin-wkwebview-engine.git",
"cordova-plugin-x-socialsharing": "^5.6.2",
"es6-promise-plugin": "^4.2.2",
"ionic-angular": "^3.9.5",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "4.5.1",
"rxjs": "^5.5.11",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.10"
},
"devDependencies": {
"@ionic/app-scripts": "3.2.1",
"ionic": "^4.6.0"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": [
"ios",
{
"platform": "ios",
"version": "",
"locator": "ios"
}
],
"description": "foodselfie-mobile: An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-app-version": {},
"cordova-plugin-camera": {
"CAMERA_USAGE_DESCRIPTION": " ",
"PHOTOLIBRARY_USAGE_DESCRIPTION": " "
},
"cordova-plugin-console": {},
"cordova-plugin-device": {},
"cordova-plugin-facebook4": {
"APP_ID": "1656999707908335",
"APP_NAME": "FoodSelfieAppi9"
},
"cordova-plugin-geolocation": {
"GEOLOCATION_USAGE_DESCRIPTION": " "
},
"cordova-plugin-googleplus": {
"REVERSED_CLIENT_ID": "com.googleusercontent.apps.624818110000-cq2sd1e71ihbp7ts43474ch7mhj03gei"
},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-wkwebview-engine": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-x-socialsharing": {},
"cordova-plugin-file": {},
"cordova-plugin-google-analytics": {},
"cordova-plugin-advanced-http": {}
},
"platforms": [
"android",
"browser"
]
}
}
How can I fix tis?
P.S.: sorry for my english, I’m brazilian xD.