Cannot find namespace 'moment' - ionic-framework

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

Related

UNMET PEER DEPENDENCY error for ionic-paypal

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.

Ionic: package.json missing start script

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'

Ionic 3: ios-file-picker crashing app on device running iOS 10.x, not 11

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"
}

Runtime Error Cannot read property '_getPortal' of undefined

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

Ionic 2 - watch failed: A watch configured to watch the following paths failed to start

I've been trying to get the Ionic watch to work, but I've been getting an error.
I created a brand new app with the following command:
ionic start my-app --v2
This seems to work fine, then I try to serve the app
ionic serve -p $PORT
However, I get the following error
watch failed: A watch configured to watch the following paths failed to start. It likely that a file
referenced does not exist: /home/ubuntu/workspace/my-app/src/**/*.(ts|html|s(c|a)ss)
I can see that the src folder does exist in the path shown in the error. Is there a way I can resolve this error? I'm using the C9 IDE and installed Ionic with the following command
sudo npm install ionic cordova -g
Here is my package.json in case it is needed:
{
"name": "ionic-hello-world",
"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": "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.1.0",
"#ionic-native/splash-screen": "3.1.0",
"#ionic-native/status-bar": "3.1.0",
"#ionic/storage": "2.0.0",
"ionic-angular": "2.2.0",
"ionicons": "3.0.0",
"rxjs": "5.0.1",
"sw-toolbox": "3.4.0",
"zone.js": "0.7.2"
},
"devDependencies": {
"#ionic/app-scripts": "1.1.4",
"typescript": "2.0.9"
},
"cordovaPlugins": [
"cordova-plugin-whitelist",
"cordova-plugin-statusbar",
"cordova-plugin-console",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": [],
"description": "my-app: An Ionic project"
}
I had the same error, I resolved it by deleting node_modules directory and run npm install