I have a simple ion-select component in my html file like this:
<ion-row><ion-item class="login-item">
<ion-label floating> Companies</ion-label>
<ion-select [(ngModel)]="storeid">
<ion-option value="1"> store1</ion-option>
<ion-option value="2"> store2</ion-option>
</ion-select>
</ion-item></ion-row>
And My package.json is like this:
{
"name": "ionic-hello-world",
"version": "0.0.0",
"author": "Ionic Framework",
"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/common": "4.0.2",
"#angular/compiler": "4.0.2",
"#angular/compiler-cli": "4.0.2",
"#angular/core": "4.0.2",
"#angular/forms": "4.0.2",
"#angular/http": "4.0.2",
"#angular/platform-browser": "4.0.2",
"#angular/platform-browser-dynamic": "4.0.2",
"#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",
"angular2-swing": "^0.7.1",
"ionic-angular": "3.2.1",
"ionic2-auto-complete": "^1.4.2-release",
"ionic2-super-tabs": "^2.3.0",
"ionicons": "3.0.0",
"ng2-swipe-cards": "^1.0.14",
"rxjs": "5.1.1",
"sw-toolbox": "3.4.0",
"zone.js": "^0.8.5"
},
"devDependencies": {
"#ionic/app-scripts": "1.3.6",
"typescript": "~2.2.1"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"ionic-plugin-keyboard",
"cordova-plugin-splashscreen"
],
"cordovaPlatforms": [],
"description": "An Ionic project"
}
When i click to the select in the view it crashes and runtime error stack is as below:
TypeError: Cannot read property '_getPortal' of undefined
at App.present (http://localhost:8100/build/main.js:17984:52)
at Alert.present (http://localhost:8100/build/main.js:49299:26)
at Select.open (http://localhost:8100/build/main.js:71893:17)
at Select._click (http://localhost:8100/build/main.js:71758:14)
at Object.eval [as handleEvent] (ng:///AboutModule/About.ngfactory.js:433:43)
at handleEvent (http://localhost:8100/build/main.js:12303:138)
at callWithDebugContext (http://localhost:8100/build/main.js:13511:42)
at Object.debugHandleEvent [as handleEvent] (http://localhost:8100/build/main.js:13099:12)
at dispatchEvent (http://localhost:8100/build/main.js:9278:21)
at http://localhost:8100/build/main.js:9868:38
Everything is so simple and I dont understand what can be the problem.
I had the same error message in my app. The error was created from custom component module file: components.module.ts.
I added this import entry IonicModule.forRoot(MyCustomComponent).
After this, no way to make alert, loading, etc working.
Solution was to remove .forRoot(MyCustomComponent)
Hope this will help some guys around
Related
I was trying to install paypal & onesignal plugin from official website with the help of official documentations and I got this error:
+-- UNMET PEER DEPENDENCY #ionic-native/core#4.3.2
`-- #ionic-native/paypal#5.30.0
Here is my Package.json
{
"name": "ionic-hello-world",
"version": "0.0.0",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"#angular/common": "5.0.0",
"#angular/compiler": "5.0.0",
"#angular/compiler-cli": "5.0.0",
"#angular/core": "5.0.0",
"#angular/forms": "5.0.0",
"#angular/http": "5.0.0",
"#angular/platform-browser": "5.0.0",
"#angular/platform-browser-dynamic": "5.0.0",
"#ionic-native/core": "4.3.2",
"#ionic-native/onesignal": "^5.30.0",
"#ionic-native/paypal": "^5.30.0",
"#ionic-native/splash-screen": "4.3.2",
"#ionic-native/status-bar": "4.3.2",
"#ionic/storage": "2.1.3",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"rxjs": "5.5.2",
"sw-toolbox": "3.6.0",
"woocommerce-api": "^1.5.0",
"zone.js": "0.8.18"
},
"devDependencies": {
"#ionic/app-scripts": "^3.2.4",
"typescript": "2.4.2"
},
"cordovaPlugins": [
"ionic-plugin-keyboard",
"cordova-plugin-whitelist",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"cordova-plugin-console",
"cordova-plugin-splashscreen"
],
"cordovaPlatforms": [],
"description": "ClickThrough: An Ionic project"
}
The PayPal service used by ionic-native/paypal has been deprecated for years and is end of life on December 7.
You should instead integrate the v2/checkout/orders API from a server, with or without the JS front end for the approval flow.
Approval requires a full mobile browser or SFSafariViewController/Chrome Custom Tabs. Approval cannot be given in a WKWebView or similar.
My package.json doesn't have a start script, so npm start will not work.
My package.json looks like
{
"name": "ionic-hello-world",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"build": "ionic-app-scripts build",
"watch": "ionic-app-scripts watch",
"serve:before": "watch",
"emulate:before": "build",
"deploy:before": "build",
"build:before": "build",
"run:before": "build"
},
"dependencies": {
"#angular/common": "2.2.1",
"#angular/compiler": "2.2.1",
"#angular/compiler-cli": "2.2.1",
"#angular/core": "2.2.1",
"#angular/forms": "2.2.1",
"#angular/http": "2.2.1",
"#angular/platform-browser": "2.2.1",
"#angular/platform-browser-dynamic": "2.2.1",
"#angular/platform-server": "2.2.1",
"#ionic/storage": "1.1.7",
"#agm/core": "1.0.0-beta.0",
"es6-promise": "3.0.2",
"es6-shim": "^0.35.0",
"ionic-angular": "2.0.0",
"ionic-native": "^2.2.14",
"ionicons": "3.0.0",
"ng2-cordova-oauth": "0.0.6",
"rxjs": "5.0.0-beta.12",
"sw-toolbox": "3.4.0",
"zone.js": "0.6.26"
},
"devDependencies": {
"#ionic/app-scripts": "1.0.0",
"typescript": "2.1.5"
},
"cordovaPlugins": [
"cordova-plugin-device",
"cordova-plugin-console",
"cordova-plugin-whitelist",
"cordova-plugin-splashscreen",
"cordova-plugin-statusbar",
"ionic-plugin-keyboard",
"cordova-plugin-inappbrowser"
],
"cordovaPlatforms": [
"ios",
{
"platform": "ios",
"version": "",
"locator": "ios"
}
],
"description": "third-party-auth-ionic2-tutorial: An Ionic project"
}
What should the start script contain?
From what I have found, Ionic projects do not use a start script in the package.json, so npm start is not needed.
use ionic start to create a new project and ionic serve to run the project during development as described in the Getting Started Guide.
There are other commands to build, deploy and package your project when needed, make sure to check the ionic documentation for how to do these the 'Ionic way'
I'm using the plugin here: iOSFilePicker to access iCloud from my app to grab a file.
It works in debug on my machine, built through ionic command line with:
ionic cordova build ios --prod --release
However, when I actually archive the build in Xcode and release through the store beta channel for testing, the app crashes when I invoke the iOSFilePicker on an iOS 10.x device (iPhone 5).
Has anyone got an idea why?
Things to note:
working fine on iOS 11.x (iPhone 6 + 6s)
No errors, just a complete crash back to the home-screen iOS 10.x
I enabled capabilities for iCloud in Xcode, see screenshot below...
...despite the containers checkboxes not being ticked, it works when I run it on ios 11.x devices.
For reference, here's my package.json:
{
"name": "mycompany-web-ionic",
"version": "0.0.1",
"author": "MyCompany Ltd",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"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": "5.2.9",
"#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.7.0",
"#ionic-native/core": "4.7.0",
"#ionic-native/device": "4.7.0",
"#ionic-native/file": "4.7.0",
"#ionic-native/file-chooser": "4.7.0",
"#ionic-native/file-picker": "^4.7.0",
"#ionic-native/file-transfer": "4.7.0",
"#ionic-native/keyboard": "4.7.0",
"#ionic-native/network": "4.7.0",
"#ionic-native/splash-screen": "4.7.0",
"#ionic-native/status-bar": "4.7.0",
"#ionic/pro": "^1.0.20",
"#ionic/storage": "2.1.3",
"angular2-fusioncharts": "^1.0.2-rc.5",
"highcharts": "^6.1.0",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"moment": "^2.22.1",
"rxjs": "5.5.7",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.20"
},
"devDependencies": {
"#ionic/app-scripts": "^3.1.9",
"typescript": "~2.6.2"
},
"description": "An Ionic project"
}
I have installed:
npm install #ionic-native/core --save
ionic cordova plugin add cordova-plugin-speechrecognition --save
and I can even see it in package.json but when I am adding it in app.module.ts I am getting this error:
Cannot find module '#ionic-native/speech-recognition'
I do not understand what to do, I have removed it and added it many times but nothing is working.
My package.json code is below
{
"name": "quicktask",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"#angular/common": "4.4.4",
"#angular/compiler": "4.4.4",
"#angular/compiler-cli": "4.4.4",
"#angular/core": "4.4.4",
"#angular/forms": "4.4.4",
"#angular/http": "4.4.4",
"#angular/platform-browser": "4.4.4",
"#angular/platform-browser-dynamic": "4.4.4",
"#ionic-native/core": "^4.3.2",
"#ionic-native/firebase": "^4.4.2",
"#ionic-native/in-app-browser": "^4.5.2",
"#ionic-native/splash-screen": "4.3.2",
"#ionic-native/status-bar": "4.3.2",
"#ionic/storage": "^2.0.1",
"cordova-android": "^6.2.3",
"cordova-browser": "5.0.1",
"cordova-plugin-device": "^1.1.4",
"cordova-plugin-firebase": "^0.1.24",
"cordova-plugin-inappbrowser": "^1.7.2",
"cordova-plugin-ionic-webview": "^1.1.11",
"cordova-plugin-speechrecognition": "^1.2.0",
"cordova-plugin-splashscreen": "^4.0.3",
"cordova-plugin-whitelist": "^1.3.1",
"cordova-sqlite-storage": "^2.1.2",
"ionic-angular": "3.8.0",
"ionic-plugin-keyboard": "^2.2.1",
"ionicons": "3.0.0",
"rxjs": "5.4.3",
"sw-toolbox": "3.6.0",
"time-ago-pipe": "^1.2.1",
"zone.js": "0.8.18"
},
"devDependencies": {
"#ionic/app-scripts": "3.0.1",
"typescript": "2.3.4"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-device": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-whitelist": {},
"ionic-plugin-keyboard": {},
"cordova-plugin-firebase": {},
"cordova-sqlite-storage": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-speechrecognition": {}
},
"platforms": [
"android",
"browser"
]
}
}
As per the docs, here, you will need to run npm install --save #ionic-native/speech-recognition in addition to installing the cordova plugin
I am using ionic 2.
I create new project
ionic start Ismart --v2
The project was successfully created.
I tried to run the project using ionic serve
I am getting this err
Cannot find namespace 'moment'
Here is my Package.Json
{
"name": "ionic-hello-world",
"version": "0.0.0",
"author": "Ionic Framework",
"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/common": "4.0.2",
"#angular/compiler": "4.0.2",
"#angular/compiler-cli": "4.0.2",
"#angular/core": "4.0.2",
"#angular/forms": "4.0.2",
"#angular/http": "4.0.2",
"#angular/platform-browser": "4.0.2",
"#angular/platform-browser-dynamic": "4.0.2",
"#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.1.0",
"ionicons": "3.0.0",
"rxjs": "5.1.1",
"sw-toolbox": "3.4.0",
"zone.js": "^0.8.5"
},
"devDependencies": {
"#ionic/app-scripts": "1.3.6",
"typescript": "~2.2.1"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": [],
"description": "ISmartpremises: An Ionic project"
}
How can i fix this issue...
Kindly advice me,
Thanks
I cannot see any issue in your package.json file.I think you have forgotten to change the directory.
You can try as shown below.
d:\ionic2 > ionic start Ismart blank --v2
d:\ionic2\Ismart> ionic serve