Errors when upgrading to Ionic 3 - ionic-framework

package.json
"dependencies": {
"#angular/common": "4.0.0",
"#angular/compiler": "4.0.0",
"#angular/compiler-cli": "4.0.0",
"#angular/core": "4.0.0",
"#angular/forms": "4.0.0",
"#angular/http": "4.0.0",
"#angular/platform-browser": "4.0.0",
"#angular/platform-browser-dynamic": "4.0.0",
"#ionic-native/core": "^3.4.2",
"#ionic-native/splash-screen": "3.4.2",
"#ionic-native/status-bar": "3.4.2",
"#ionic/storage": "2.0.1",
"ionic-angular": "3.0.1",
"ionicons": "3.0.0",
"rxjs": "5.1.1",
"sw-toolbox": "3.4.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"#ionic/app-scripts": "1.3.0",
"typescript": "~2.2.1"
},
When I wanna change my version of Ionic from Ionic2 to Ionic3, I encountered some errors Is it my version of #angular/core outdated or? [Sorry I could not copy and paste the errors here, only can snip a photo of it.]

Related

How to stop ionic cordova run android command delete existing ionic apps on the device

I'm new to the forum and need help on running/installing ionic 3 app on a real device.
This command: ionic cordova run android (in my case) will delete the existing ionic app being installed on the device even though the app names are different.
I'd tried using ionic cordova run android --prod --release but the result is the same, i.e. Only ONE ionic app will be installed on the Android device which doesn't sound right.
Is there a way to prevent that from happening? Any options? Below is my package.json file:
"dependencies": {
"#angular/common": "5.0.3",
"#angular/compiler": "5.0.3",
"#angular/compiler-cli": "5.0.3",
"#angular/core": "5.0.3",
"#angular/forms": "5.0.3",
"#angular/http": "5.0.3",
"#angular/platform-browser": "5.0.3",
"#angular/platform-browser-dynamic": "5.0.3",
"#ionic-native/core": "4.4.0",
"#ionic-native/splash-screen": "4.4.0",
"#ionic-native/status-bar": "4.4.0",
"#ionic/pro": "1.0.16",
"#ionic/storage": "2.1.3",
"cordova-android": "6.3.0",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-ionic-webview": "^1.1.16",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-whitelist": "^1.3.1",
"ionic-angular": "3.9.2",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"rxjs": "5.5.2",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.18"
},
Have you changed the package name of that App? This issue happened when package name of Apps are same.

VS Code Typescript intellisense does not read correctly Typings

I have installed in my Ionic 3 project pdfjs-dist from npm and the typings from DT, but I do not get the correct intellisense, look: http://imgur.com/ctIqkE7
VS Code: 1.12.2
Typescript: 2.3.3
In my typings folder I have:
Typings
Globals
pdf
index.d.ts
My tsconfig.json says:
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"dom",
"es2015"
],
"module": "es2015",
"moduleResolution": "node",
"sourceMap": true,
"target": "es5",
"allowJs": true
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules"
],
"compileOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}
and my dependencies are:
"dependencies": {
"#angular/common": "4.1.2",
"#angular/compiler": "4.1.2",
"#angular/compiler-cli": "4.1.2",
"#angular/core": "4.1.2",
"#angular/forms": "4.1.2",
"#angular/http": "4.1.2",
"#angular/platform-browser": "4.1.2",
"#angular/platform-browser-dynamic": "4.1.2",
"#ionic-native/core": "3.10.2",
"#ionic-native/splash-screen": "3.10.2",
"#ionic-native/status-bar": "3.10.2",
"#ionic/storage": "2.0.1",
"#types/pdf": "0.0.31",
"cordova-android": "^6.2.3",
"cordova-ios": "^4.4.0",
"cordova-plugin-console": "^1.0.5",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-statusbar": "^2.2.2",
"cordova-plugin-whitelist": "^1.3.1",
"ionic-angular": "3.3.0",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"pdfjs-dist": "^1.8.428",
"rxjs": "5.1.1",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.11"
},
"devDependencies": {
"#ionic/app-scripts": "1.3.7",
"#ionic/cli-plugin-cordova": "1.3.0",
"#ionic/cli-plugin-ionic-angular": "1.3.0",
"typescript": "2.3.3"
},
I have looked other questions here like this or this and did not find an solution.
Edit:
I had added updated my includes with the path to the dt typings "typings/**/*.d.ts" and I had this warning while compiling:
typescript: node_modules/#types/pdf/index.d.ts, line: 51
Duplicate string index signature.
L51: * A unique ID to identify a PDF. Not guaranteed to be unique. [jbaldwin: haha what]
L52: **/
That point me out that the types are not been reading from typings/** but from node_modules/#types/. I took a look and saw that both index.d.ts files are exactly the same so I uninstalled the typings outside node.
After a while of looking into it I have two main theories about my problem.
1. I do not know what I am doing (Very possible)
2. The Typings are wrong and/or Outdated.
I have found a PDFJSStatic interface that contains the "unintellisensed" method in my screen capture that is exported in the typings. If I do something like:
import * as PDF_JS from 'pdfjs-dist';
let pdfjsLib : PDFJSStatic = PDF_JS;
I finally get Info about the getDocument() method but a lot of other functions get broken.
If I get the PDFJSStatic as an own variable:
var PDFJSStatic : PDFJSStatic = pdfjsLib.PDF;
The intellisense works but obviously the functions does not exist.

Error While Adding New Provider in ionic

When i try to add a new provider to my existing ionic project it throws
The generate command is only available for projects t
hat use ionic-angular >= 3.0.0
I tried the following command to upgrade but it doesn't worked out
>npm install --save ionic-angular
My Ionic Version is 3.2.0
My Package.json looks
"dependencies": {
"#angular/common": "2.4.8",
"#angular/compiler": "2.4.8",
"#angular/compiler-cli": "2.4.8",
"#angular/core": "2.4.8",
"#angular/forms": "2.4.8",
"#angular/http": "2.4.8",
"#angular/platform-browser": "2.4.8",
"#angular/platform-browser-dynamic": "2.4.8",
"#angular/platform-server": "2.4.8",
"#angular/tsc-wrapped": "~0.5.2",
"#ionic/storage": "2.0.0",
"ionic-angular": "^2.3.0",
"ionic-native": "2.4.1",
"ionicons": "3.0.0",
"lodash-es": "^4.17.4",
"node-uuid": "^1.4.7",
"rxjs": "5.0.1",
"sw-toolbox": "3.4.0",
"uuid": "^2.0.2",
"zone.js": "0.7.2"
}

Cannot read property 'URI' of undefined, Ionic2

"TypeError: Cannot read property 'URI' of undefined"
I got this error whenever I try to use native screenshot method in Ionic2.
My code:
this.screenshot.URI(80).then((result) => {
console.log(result);
}, (err) => {
console.log(err);
});
This is Ionic2 screenshot documentation: https://ionicframework.com/docs/native/screenshot/
"dependencies": {
"#angular/common": "4.0.0",
"#angular/compiler": "4.0.0",
"#angular/compiler-cli": "4.0.0",
"#angular/core": "4.0.0",
"#angular/forms": "4.0.0",
"#angular/http": "4.0.0",
"#angular/platform-browser": "4.0.0",
"#angular/platform-browser-dynamic": "4.0.0",
"#ionic-native/camera": "^3.6.0",
"#ionic-native/core": "3.6.1",
"#ionic-native/file": "^3.6.0",
"#ionic-native/file-path": "^3.6.0",
"#ionic-native/screenshot": "^3.6.1",
"#ionic-native/splash-screen": "3.4.2",
"#ionic-native/status-bar": "3.4.2",
"#ionic-native/transfer": "^3.6.0",
"#ionic/storage": "2.0.1",
"crypto-js": "3.1.9-1",
"fast-sha256": "1.0.0",
"ionic-angular": "3.0.1",
"ionic-native": "^3.5.0",
"ionicons": "3.0.0",
"rxjs": "5.1.1",
"sha256": "0.2.0",
"sw-toolbox": "3.4.0",
"ts-md5": "1.2.0",
"zone.js": "^0.8.4"

create project in ionic with --v2 and framework are 3

I created a project with
ionic start navigationAppv2 blank --v2
but when I use ionic info say:
Ionic Framework Version: 3.0.0
how can I solve this?
Not sure what you mean but I suspect you want to downgrade your Ionic framework version? If so, you just need to update your package.json to "ionic-angular": "2.3.0" for instance. The below is an extract of my package.json file running on the latest v2 version:
"#angular/common": "2.4.8",
"#angular/compiler": "2.4.8",
"#angular/compiler-cli": "2.4.8",
"#angular/core": "2.4.8",
"#angular/forms": "2.4.8",
"#angular/http": "2.4.8",
"#angular/platform-browser": "2.4.8",
"#angular/platform-browser-dynamic": "2.4.8",
"#angular/platform-server": "2.4.8",
"#ionic-native/core": "3.4.4",
"#ionic-native/device": "3.4.4",
"#ionic-native/in-app-browser": "3.4.4",
"#ionic-native/local-notifications": "3.4.4",
"#ionic-native/splash-screen": "3.4.4",
"#ionic-native/status-bar": "3.4.4",
"#ionic/storage": "2.0.0",
"ionic-angular": "2.3.0"