Closed ahilangopal closed 4 years ago
Did you solve it?
Same problem here, but i had with LocalNotifications. So, after searching for hours i solved my problem with these steps:
"compilerOptions": {
{"target": "es2015"}
}
"scripts": {
"postinstall": "ngcc --properties es2015 browser module main --first-only --create-ivy-entry-points",
}
Angular compatibility compiler (ngcc) By adding the postinstall script below in your package.json, you make sure your node_modules will be compatible with the Ivy renderer. It will be run after a npm install.
References:
npm install
to create package-lock.json.npm ci
This command is similar to npm-install, except it’s meant to be used in automated environments such as test platforms, continuous integration, and deployment – or any situation where you want to make sure you’re doing a clean install of your dependencies. It can be significantly faster than a regular npm install by skipping certain user-oriented features. It is also more strict than a regular install, which can help catch errors or inconsistencies caused by the incrementally-installed local environments of most npm users. Reference:
ng build --prod
or ionic build --prod
😄The options --prod build and check your code and if pass everything is OK. Else, you'll get an error and the reason. In this case if you get an error jump to Extra step down bellow
If this problem persist add this at tsconfig.app.json
"angularCompilerOptions": {
"enableIvy": false
}
By default Angular 9 has Ivy as native and this code disable ivy compiler to be compatibility with old version of Angular like 2 until 8.
npm cache clean --force
does not work for this issue@albuquerquefabio I have tried with 1-7. But it didn't work for me. I don't like to remove iVY on my project. So I'll not do the next step. My issue: https://github.com/ionic-team/ionic-native/issues/3452
Can anyone please provide a demo app that can replicate this issue? Testing thing locally and I am unable to replicate.
Similar to #3452, you are putting the File
class in imports, when it belongs in the providers array.
As stated in the docs here:
Can anyone please provide a demo app that can replicate this issue? Testing thing locally and I am unable to replicate.
For me i just create a new project running ionic start
with angular and capacitor and after run ionic cap add android
to add android platform. Then i add LocalNotification like Ionic native tutorial and put LocalNotifications at providers and finally when you build with android studio, i got a error as described here and also here https://github.com/ionic-team/ionic-native/issues/3452
@albuquerquefabio Please provide a sample app.
core.js:36228 Uncaught TypeError: Cannot read property 'id' of undefined
at registerNgModuleType (core.js:36228)
at core.js:36246
at Array.forEach (
I am using ionic5 (Capacitor) with Angular9 Ivy, when I tried to use/declare File plugin I am getting below error. I have tried all other plugin same error.
import { File } from '@ionic-native/file/ngx';
Ionic:
Ionic CLI : 6.5.0 Ionic Framework : @ionic/angular 5.1.0 @angular-devkit/build-angular : 0.901.5 @angular-devkit/schematics : 9.1.1 @angular/cli : 9.1.1 @ionic/angular-toolkit : 2.2.0
Capacitor:
Capacitor CLI : 1.1.1 @capacitor/core : 1.1.1
Utility:
cordova-res (update available: 0.11.0) : 0.10.0 native-run : 1.0.0
System:
NodeJS : v12.16.1 (C:\Program Files\nodejs\node.exe) npm : 6.13.4 OS : Windows 10
Angular Info Angular CLI: 9.1.1 Node: 12.16.1 OS: win32 x64
Angular: 9.1.6 ... animations, common, compiler, compiler-cli, core, forms ... language-service, localize, platform-browser ... platform-browser-dynamic, router, service-worker Ivy Workspace: Yes
Package Version
@angular-devkit/architect 0.803.26 @angular-devkit/build-angular 0.901.5 @angular-devkit/build-optimizer 0.901.5 @angular-devkit/build-webpack 0.901.5 @angular-devkit/core 9.1.1 @angular-devkit/schematics 9.1.1 @angular/cdk 9.2.3 @angular/cli 9.1.1 @angular/material 9.2.3 @ngtools/webpack 9.1.5 @schematics/angular 9.1.5 @schematics/update 0.901.1 rxjs 6.5.5 typescript 3.7.5 webpack 4.42.0