Hello, I have got some problems with my ionic-3 app. Firs of all everything was working good then I wanted to make some unit tests. Now, I am getting the error in the title when I make ionic serve
First of all I installed jasmine/karma etc. Then I got some test examples from https://github.com/ionic-team/ionic-unit-testing-example . Then when I run the test I got erros that say
Can not find module core-js/es6
Can not find module core-js/es7/reflect
Those where dependencies in the config file of test. Then I installed core-js but I got the same error, then I learned the right version should be core-js@2.5.x
. After that this error is gone but another one came.
Your webpack version is too old use at least 4
Then as a result of this stackoverflow thread https://stackoverflow.com/questions/50973494/ionic-unit-testing-webpack-version instead of updating webpack version I downgraded the ts-loader
and ts-node
to the folllowing versons
"ts-loader": "^3.0.3",
"ts-node": "^3.0.2",
And I got the following
kind of compiler errors but it worked. I mean tests got executed and passed.
But still I though I should not get these compiling errors and this time I tried instead of downgrading ts-loader
and ts-node
I updated the webpack to the latest without even knowing the current version because it wasn’t in my packeage.json file but it was loaded. Anyways, After updating webpack version nothing worked.
Jasmine/karma gave the same errors Can not find module core-js/es6
etc because I updated ts-node and ts-loader to their original/latest versions. BUt even worse even ionic serve
gives me the error in the title.
What I tried:
None of them worked again .I made a new project with same ionic version and checked the versions of webpack and core-js. Resullts were :
`-- @ionic/app-scripts@3.2.2
`-- webpack@3.12.0
and for core-js
`-- (empty)
although it’s package.json doesn’t have webpack and core-js. and mine for webpack :
`-- @ionic/app-scripts@3.2.1
`-- webpack@3.12.0
and for core-js
+-- core-js@2.5.0
+-- firebase@5.11.1
| `-- @firebase/polyfill@0.3.13
| `-- core-js@3.0.1
+-- karma@4.1.0
| `-- core-js@2.6.9
`-- karma-webpack@3.0.5
`-- babel-runtime@6.26.0
`-- core-js@2.6.
And my current package.json is :
{
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"start": "ionic-app-scripts serve",
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"test": "karma start ./test-config/karma.conf.js",
"test-ci": "karma start ./test-config/karma.conf.js --single-run",
"test-coverage": "karma start ./test-config/karma.conf.js --coverage",
"e2e": "npm run e2e-update && npm run e2e-test",
"e2e-test": "protractor ./test-config/protractor.conf.js",
"e2e-update": "webdriver-manager update --standalone false --gecko false"
},
"dependencies": {
"@angular/animations": "5.2.11",
"@angular/common": "5.2.11",
"@angular/compiler": "5.2.11",
"@angular/compiler-cli": "5.2.11",
"@angular/core": "5.2.11",
"@angular/forms": "5.2.11",
"@angular/http": "5.2.11",
"@angular/platform-browser": "5.2.11",
"@angular/platform-browser-dynamic": "5.2.11",
"@ionic-native/camera": "^4.20.0",
"@ionic-native/core": "~4.18.0",
"@ionic-native/crop": "^4.20.0",
"@ionic-native/file": "^4.20.0",
"@ionic-native/file-path": "^4.20.0",
"@ionic-native/file-transfer": "^4.20.0",
"@ionic-native/firebase": "^4.20.0",
"@ionic-native/geolocation": "^4.20.0",
"@ionic-native/keyboard": "^4.20.0",
"@ionic-native/native-storage": "^4.20.0",
"@ionic-native/network": "^4.20.0",
"@ionic-native/splash-screen": "~4.18.0",
"@ionic-native/status-bar": "~4.18.0",
"@ionic/storage": "^2.2.0",
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/http-loader": "^4.0.0",
"@scaffold-digital/ionic-hardware-buttons": "^1.1.0",
"angularfire2": "^5.1.2",
"cordova": "^8.1.2",
"cordova-android": "7.1.4",
"cordova-android-support-gradle-release": "3.0.0",
"cordova-ios": "4.5.5",
"cordova-plugin-camera": "^4.0.3",
"cordova-plugin-crop": "git+https://github.com/obeza/cordova-plugin-crop-with-ratio.git",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-file": "^6.0.1",
"cordova-plugin-file-transfer": "^1.7.1",
"cordova-plugin-filepath": "^1.5.1",
"cordova-plugin-firebase": "git+https://github.com/dpa99c/cordova-plugin-firebase.git#GH-1057-April-05-android-build-issue",
"cordova-plugin-geolocation": "^4.0.1",
"cordova-plugin-ionic-keyboard": "^2.1.3",
"cordova-plugin-ionic-webview": "^3.1.2",
"cordova-plugin-nativestorage": "^2.3.2",
"cordova-plugin-network-information": "^2.0.1",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-statusbar": "^2.4.2",
"cordova-plugin-whitelist": "^1.3.3",
"core-js": "^2.5.0",
"firebase": "^5.9.1",
"ionic-angular": "3.9.3",
"ionicons": "3.0.0",
"promise-polyfill": "^8.1.0",
"rxjs": "^6.3.3",
"rxjs-compat": "^6.4.0",
"sw-toolbox": "3.6.0",
"time-ago-pipe": "^1.3.2",
"webpack": "^3.0.0",
"zone.js": "0.8.29"
},
"devDependencies": {
"@ionic/app-scripts": "3.2.1",
"@types/jasmine": "^3.3.13",
"@types/node": "^12.0.4",
"angular2-template-loader": "^0.6.2",
"html-loader": "^0.5.5",
"istanbul-instrumenter-loader": "^3.0.1",
"jasmine": "^3.4.0",
"jasmine-spec-reporter": "^4.2.1",
"karma": "^4.1.0",
"karma-chrome-launcher": "^2.2.0",
"karma-coverage-istanbul-reporter": "^2.0.5",
"karma-jasmine": "^2.0.1",
"karma-jasmine-html-reporter": "^1.4.2",
"karma-sourcemap-loader": "^0.3.7",
"karma-webpack": "^3.0.5",
"null-loader": "^2.0.0",
"protractor": "^5.4.2",
"ts-loader": "^3.0.3",
"ts-node": "^3.0.2",
"typescript": "~2.6.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {
"ANDROID_SUPPORT_ANNOTATIONS_VERSION": "27.+"
},
"cordova-plugin-ionic-keyboard": {},
"cordova-plugin-geolocation": {},
"cordova-plugin-camera": {},
"com-badrit-base64": {},
"cordova-plugin-file": {},
"cordova-plugin-file-transfer": {},
"cordova-plugin-filepath": {},
"cordova-plugin-nativestorage": {},
"cordova-plugin-crop": {},
"cordova-plugin-network-information": {},
"cordova-plugin-firebase": {},
"cordova-android-support-gradle-release": {
"ANDROID_SUPPORT_VERSION": "27.+"
}
},
"platforms": [
"ios",
"android"
]
}
}
Any help would be much appericaed. Thanks.