Cannot get ng-bootstrap component to work outside app.component - bootstrap-5

I'm facing an issue when working with ng-bootstrap widgets in my angular app.
I'm using angular 15 and ng-bootstrap 14 as shown below:
#angular-devkit/architect 0.1501.6
#angular-devkit/build-angular 15.1.6
#angular-devkit/core 15.1.6
#angular-devkit/schematics 15.1.6
#angular/cli 15.1.6
#schematics/angular 15.1.6
rxjs 7.8.0
typescript 4.9.5
dependencies on package.json:
"#angular/animations": "^15.1.0",
"#angular/common": "^15.1.0",
"#angular/compiler": "^15.1.0",
"#angular/core": "^15.1.0",
"#angular/forms": "^15.1.0",
"#angular/platform-browser": "^15.1.0",
"#angular/platform-browser-dynamic": "^15.1.0",
"#angular/router": "^15.1.0",
"#ng-bootstrap/ng-bootstrap": "^14.0.1",
"#popperjs/core": "^2.11.6",
"bootstrap": "^5.2.3",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.12.0"
The problem I have is that I'm importing NgbModule on my app.module.ts as suggested on ng-bootstrap getting started section (https://ng-bootstrap.github.io/#/getting-started) but the widgets such as ngb-accordion only seem to work within my app.component.html and I cannot get it to work on any other component. The code I tried so far is as follows:
app.module.ts:
import { NgModule } from '#angular/core';
import { BrowserModule } from '#angular/platform-browser';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import { NgbModule } from '#ng-bootstrap/ng-bootstrap';
#NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
AppRoutingModule,
NgbModule
],
providers: [],
bootstrap: [AppComponent],
exports:[NgbModule]
})
export class AppModule { }
And the error it gives when compiling is:
Error: src/components/bootstrap-components/accordion/accordion.component.html:38:1 - error NG8001: 'ngb-accordion' is not a known element:
1. If 'ngb-accordion' is an Angular component, then verify that it is part of this module.
2. If 'ngb-accordion' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '#NgModule.schemas' of this component to suppress this message.
I tried putting the accordion in my app.component html and it works nicely but on any other component it does not.
What I also tried and did work is mark the AccordionComponent (of my project) as standalone and adding NgbModule in its imports array, but I don't think having to make all my components standalone for it to work is a good solution.
I did not post the entire code of the component to make this post more readable, but the full code of the project can be downloaded here: https://gitlab.com/arendevel/bootstrap-pwrd-angular
Any ideas? I'm new to angular + bootstrap development and I have researched stackoverflow [ng-bootstrap] tag a lot in hopes of finding a solution but I can't seem to be able to find it.

Related

Unable to set up backend for In app purchases

I have written the cloud functions as per this https://codelabs.developers.google.com/codelabs/flutter-in-app-purchases#0. In the section 10, to verify the purchases a 3rd party Javascript called node-apple-receipt-verify is used. I have added this package in the package.json like this
"dependencies": {
"firebase-admin": "^9.8.0",
"firebase-functions": "^3.14.1",
"node-apple-receipt-verify": "^1.9.3"
},
"devDependencies": {
"#types/node-apple-receipt-verify": "^1.7.0",
"#typescript-eslint/eslint-plugin": "^3.9.1",
"#typescript-eslint/parser": "^3.8.0",
"eslint": "^7.6.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-import": "^2.22.0",
"firebase-functions-test": "^0.2.0",
"typescript": "^3.8.0"
},
Also added the package in the package-lock.json file
In dependencies
"#types/node-apple-receipt-verify": {
"version": "1.7.0",
"resolved": "https://registry.npmjs.org/#types/node-apple-receipt-verify/-/node-apple-receipt-verify-1.7.0.tgz",
"integrity": "sha512-hjFcvGgA4h14V3M6XPrp5kJU1HHnIsMamME7Bz3TK7w8IcQrEc9b4wm5/p3Tng38oCwxMvDsozVnLEvitvXlkw==",
"dev": true
},
But I am getting this error
src/app-store.purchase-handler.ts:3:37 - error TS2307: Cannot find module 'node-apple-receipt-
verify' or its corresponding type declarations.
3 import * as appleReceiptVerify from "node-apple-receipt-verify";
src/app-store.purchase-handler.ts:10:16 - error TS2664: Invalid module name in augmentation,
module 'node-apple-receipt-verify' cannot be found.
10 declare module "node-apple-receipt-verify" {
~~~~~~~~~~~~~~~~~~~~~~~~~~~
You need to install the node.js package here.

App keeps launching to a blank screen Test Flight React Native expo

App is working fine in Android Device after production
and its working fine on ios expo. but when i create .ipa file for production and test app via testflight its stuck on white screen.
so app store is keep showing me this reult.
I am Attaching my App.js code
import React, { useCallback, useEffect, useState } from 'react';
import { createStackNavigator } from '#react-navigation/stack';
import { NavigationContainer } from '#react-navigation/native';
import * as SplashScreen from 'expo-splash-screen';
import { Button, Text,BackHandler, View,TouchableOpacity,StyleSheet,Image,ActivityIndicator,StatusBar,AsyncStorage } from 'react-native';
import Navigations from './Navigations'
const Stack = createStackNavigator();
function App() {
useEffect(() => {
function prepare() {
SplashScreen.hideAsync();
// Pre-load fonts, make any API calls you need to do here
}
prepare();
}, []);
return (
<NavigationContainer>
<Navigations>
</Navigations>
</NavigationContainer>
);
}
export default App;
Now my package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"#react-native-community/datetimepicker": "^3.5.2",
"#react-navigation/material-bottom-tabs": "^6.0.9",
"#react-navigation/native": "^6.0.6",
"#react-navigation/native-stack": "^6.2.5",
"#react-navigation/stack": "^6.0.11",
"#redmin_delishaj/react-native-select": "^1.0.6",
"#stripe/stripe-react-native": "0.2.2",
"#unimodules/core": "~7.2.0",
"#unimodules/react-native-adapter": "~6.5.0",
"expo": "^43.0.0",
"expo-apple-authentication": "^4.0.3",
"expo-av": "^10.1.2",
"expo-document-picker": "^10.0.3",
"expo-facebook": "^12.0.3",
"expo-google-app-auth": "~9.0.0",
"expo-image-picker": "^11.0.3",
"expo-permissions": "^13.0.3",
"expo-splash-screen": "~0.13.5",
"expo-status-bar": "^1.1.0",
"i": "^0.3.7",
"install": "^0.13.0",
"moment": "^2.29.1",
"nodemon": "^2.0.15",
"npm": "^8.1.1",
"react": "17.0.1",
"react-dom": "17.0.1",
"react-native": "0.64.3",
"react-native-credit-card-input": "^0.4.1",
"react-native-customizable-checkbox": "^1.0.14",
"react-native-dropdown-picker": "^5.2.3",
"react-native-image-overlay": "^0.1.2",
"react-native-image-pan-zoom": "^2.1.12",
"react-native-image-slider-box": "^1.1.9",
"react-native-image-viewing": "^0.2.1",
"react-native-keyboard-aware-scroll-view": "^0.9.4",
"react-native-material-menu": "^1.2.0",
"react-native-paper": "^4.9.2",
"react-native-pull-to-refresh": "^2.1.3",
"react-native-ratings": "^8.1.0",
"react-native-render-html": "^6.3.0",
"react-native-responsive-screen": "^1.4.2",
"react-native-swiper-flatlist": "^3.0.15",
"react-native-vector-icons": "^9.0.0",
"react-native-video-controls": "^2.8.1",
"react-native-web": "0.17.1",
"react-native-webview": "11.13.0"
},
"devDependencies": {
"#babel/core": "^7.12.9"
},
"private": true
}
and i am posting reply from App store
Guideline 2.1 - Performance - App Completeness
We continue to run into the same bug in your app. Specifically, your app keeps launching to a blank screen and no further content loads. Please review the details below and complete the next steps.
Review device details:
Device type: iPhone and iPad
OS version: iOS 15.1
Next Steps
Please run your app on a device to reproduce the issues, then revise and submit your app for review. If at first you're unable to reproduce the issue, try the following:
For new apps, uninstall all previous versions of your app from a device, then install and follow the steps to reproduce.
For app updates, install the new version as an update to the previous version, then follow the steps to reproduce.
If we misunderstood the intended behavior of your app, please reply to this message in Resolution Center to provide information on how these features were intended to work.
Actual Screen shot from ios Device
I am having this issue too but I believe one of my changes fixed and then introduced it. Check out your “main”: and “metro.config.js” if you have one, expo is picky in their structured workflows.
Might also be missing linked react native packages, react-native-svg makes me want to never use svgs in expo

NestJS swagger-ui-express package is missing after deploy

I am using NestJS version 7.1.0 and serverless and creating api document uses nestjs swagger. In local it's worked like champ but after deploy got error.
swagger-ui-express package is missing
I see some issue here but still not resolve this issue.
https://github.com/nestjs/swagger/issues/277
This is my package.json
"dependencies": {
"#nestjs/common": "^7.1.0",
"#nestjs/core": "^7.1.0",
"#nestjs/passport": "^7.0.0",
"#nestjs/platform-express": "^7.0.7",
"#nestjs/swagger": "^4.5.8",
"aws-serverless-express-binary": "^1.0.1",
"class-transformer": "^0.2.3",
"class-validator": "^0.11.1",
"dayjs": "^1.8.24",
"dotenv": "^8.2.0",
"dynamodb-data-types": "^3.0.1",
"express": "^4.17.1",
"faker": "^4.1.0",
"jest": "^24.9.0",
"jwks-rsa": "^1.6.0",
"latinize": "^0.4.1",
"lodash": "^4.17.15",
"mime-types": "^2.1.26",
"passport": "^0.4.1",
"passport-jwt": "^4.0.0",
"reflect-metadata": "^0.1.13",
"rimraf": "^3.0.0",
"rxjs": "^6.5.3",
"serverless-dynamodb-local": "^0.2.39",
"swagger-ui-express": "^4.1.4",
"tslint-loader": "^3.5.4",
"uuid": "^3.3.3",
"winston": "^3.2.1"
},
This is the config:
const options = new DocumentBuilder()
.setTitle("My APIs")
.setDescription("APIs description")
.setVersion("1.0")
.addTag("cats")
.build();
const document = SwaggerModule.createDocument(app, options);
SwaggerModule.setup("api", app, document);
Any help!
My solution was to install express:
npm i express
I figured out the solutions, hope this help someone.
I add a fake endpoint to make sure swagger-ui-express not be removed after webpack ran.
if (event.path === "/api") {
event.path = "/api/";
} else if (event.path.includes("/swagger-ui")) {
event.path = event.path.replace("/swagger-ui", "/api/swagger-ui");
}
// Fake to keep swagger-ui-express work after deploy
if (event.path === "/fake-swagger-ui-express") {
swaggerUi.setup(null);
}
I had to run:
yarn install
to fix it.
Do you happen to be using yarn workspaces? I had the same problem just now, where locally everything worked but broke on our cluster.
If yes, then try adding this to the package.json of your API that is using the swagger module:
"workspaces": { "nohoist": ["swagger-ui-express"] }

Angular Service Workers not work on iOS standalone mode

I am working on PWA with Ionic v4 and Angular PWA service workers. On app.component.ts have a injected service to check if updates are available on PWA and then download and reload.
When I open PWA with the browser the service works fine and If I deploy an update the service worker update the cached PWA and ‘auto-reload’ the page.
The problem comes with PWA/standalone mode, on iOS when the PWA is added to homescreen it not refreshes anymore even killing it with the task app list. Only If I shutdown the device and on again it refreshes the state of the app. On Android devices all works as expected on PWA mode.
This is my version checker service implemented with Angular service worker:
import {Injectable} from '#angular/core';
import {SwUpdate} from '#angular/service-worker';
#Injectable()
export class LogUpdateService {
constructor(updates: SwUpdate) {
console.warn('check')
updates.available.subscribe(event => {
console.log('current version is', event.current);
console.log('available version is', event.available);
updates.activateUpdate().then(() => {
console.warn('downloaded')
document.location.reload();
});
});
updates.activated.subscribe(event => {
console.log('old version was', event.previous);
console.log('new version is', event.current);
});
}
}
This is my package.json:
"dependencies": {
"#angular/common": "^7.2.9",
"#angular/core": "^7.2.9",
"#angular/forms": "^7.2.9",
"#angular/http": "^7.2.9",
"#angular/platform-browser": "^7.2.9",
"#angular/platform-browser-dynamic": "^7.2.9",
"#angular/pwa": "0.13.8",
"#angular/router": "^7.2.9",
"#angular/service-worker": "7.2.12",
"#ionic-native/core": "^5.2.0",
"#ionic-native/network": "^5.2.0",
"#ionic-native/splash-screen": "^5.2.0",
"#ionic-native/status-bar": "^5.2.0",
"#ionic/angular": "4.2.0",
"#ionic/storage": "^2.2.0",
"#ngx-translate/core": "^11.0.1",
"#ngx-translate/http-loader": "^4.0.0",
"cordova-plugin-network-information": "2.0.1",
"cordova-sqlite-storage": "3.2.0",
"core-js": "^2.6.5",
"ionic2-calendar": "^0.5.2",
"moment": "^2.24.0",
"rxjs": "~6.4.0",
"serve": "^10.1.2",
"zone.js": "~0.8.29"
},
"devDependencies": {
"#angular-devkit/architect": "0.13.8",
"#angular-devkit/build-angular": "0.13.8",
"#angular-devkit/core": "7.3.8",
"#angular-devkit/schematics": "7.3.8",
"#angular/cli": "7.3.8",
"#angular/compiler": "~7.2.9",
"#angular/compiler-cli": "~7.2.9",
"#angular/language-service": "~7.2.9",
"#ionic/angular-toolkit": "1.5.0",
"#types/jasmine": "~3.3.9",
"#types/jasminewd2": "~2.0.6",
"#types/node": "~11.11.3",
"#ionic/lab": "1.0.24",
"codelyzer": "~4.5.0",
"jasmine-core": "~3.3.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.0.1",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.5",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.4.0",
"protractor": "~5.4.2",
"ts-node": "~8.0.3",
"tslint": "~5.14.0",
"typescript": "^3.1.6"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-sqlite-storage": {},
"cordova-plugin-network-information": {}
}
}
Any Idea with this problem?
See: PWAs on iOS 12.2 beta: the good, the bad, and the "not sure yet if good"
The only solution that I found is to code a javascript function (e.g. updateiOS()) that will do the following
1- Verify if we are running on iOS standalone mode (if not then don't continue)
2- Check for a new version on the server and reload page if we found a new version (make sure this https request is not cached!)
3- Save the last check time in a variable (e.g. var lastCheckTime)
And in my main javascript function, I will create a listener for "focus" event that will check the difference between now and lastCheckTime, if it's more than let's say 1 day then call updateiOS()
so far the focus event is working fine with me

Ionic 2 convert to Ionic 3 : "Error: Failed to transpile program" on "ionic build iOS"

I've been working on setting an existing Ionic 2 project on a Apple Mac machine.
I've duplicated my project as it is described here.
After solving some Xcode issues, finally the app opens on an iPhone iOS physical device but shows a blank screen after the splash screen.
I found how to get some log displayed here. The log input lead me to that SO thread: "cannot find module ionic-native".
I concluded that I had to update my project code to match the new settings to handle ionic-native plugins.
For each plugin I applied the following process: ionic plugin rm [plugin name], ionic plugin add [plugin name], npm install --save #ionic-native/[plugin name].
I reviewed my code to change where needed, in some components and providers from:
{ NativePlugin1, NativePlugin2 } from 'ionic-native';
To:
{ NativePlugin1 } from '#ionic-native/native-plugin-1';
{ NativePlugin2 } from '#ionic-native/native-plugin-2';
I modified my [ionic project folder]/src/app/app.module.ts and added:
// all declaration as it was like "import { NgModule } from '#angular/core';"
//plus declarations added to match new rules and add plugin in providers section
{ NativePlugin1 } from '#ionic-native/native-plugin-1';
{ NativePlugin2 } from '#ionic-native/native-plugin-2';
#NgModule({
declarations: [
...
],
imports: [...
],
bootstrap: [IonicApp],
entryComponents: [...
],
providers: [
NativePlugin1,
NativePlugin2,
...
]
})
export class AppModule {}
I deleted from my package.json the line "ionic-native": "^2.7.0", as it is suggested in the solution of the SO thread I am referencing to:
You need to remove "ionic-native": "^3.5.0" from your package.json and after that run npm i.
Then I launched in that order: sudo npm cache clear, sudo npm install, and finally ionic build ios, for which I get:
"Error: Failed to transpile program"
And above this error I see plenty of errors related to the ionic-native like this one:
[14:22:15] typescript: src/services/custom-http/custom-http.ts, line:XX
Property 'type' does not exist on type 'typeof Network'.
LXX: return Network.type;
I feel stuck now so if anyone has a hint it would be welcome.
To complete here are some additional info:
ionic info gives:
Cordova CLI: 6.5.0
Ionic Framework Version: 2.0.0-rc.0
Ionic CLI Version: 2.2.3
Ionic App Lib Version: 2.2.1
Ionic App Scripts Version: 1.3.4
ios-deploy version: 1.9.1
ios-sim version: 5.0.13
OS: macOS Sierra
Node Version: v6.9.1
Xcode version: Xcode 7.3.1 Build version 7D1014
And my package.json is like this:
{
"name": "my project",
"author": "my name",
"homepage": "",
"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.0.0",
"#angular/compiler": "2.0.0",
"#angular/compiler-cli": "0.6.2",
"#angular/core": "2.0.0",
"#angular/forms": "2.0.0",
"#angular/http": "2.0.0",
"#angular/platform-browser": "2.0.0",
"#angular/platform-browser-dynamic": "2.0.0",
"#angular/platform-server": "2.0.0",
"#ionic-native/core": "^3.5.0",
"#ionic-native/device": "^3.5.0",
"#ionic-native/insomnia": "^3.5.0",
"#ionic-native/keyboard": "^3.5.0",
"#ionic-native/network": "^3.5.0",
"#ionic-native/screen-orientation": "^3.5.0",
"#ionic-native/splash-screen": "^3.5.0",
"#ionic-native/sqlite": "^3.5.0",
"#ionic-native/status-bar": "^3.5.0",
"#ionic-native/vibration": "^3.5.0",
"#ionic/storage": "1.0.3",
"ionic-angular": "2.0.0-rc.0",
"ionicons": "3.0.0",
"ng2-translate": "^3.2.1",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.6.21"
},
"devDependencies": {
"#ionic/app-scripts": "latest",
"typescript": "2.0.3"
},
"description": "MyProject: An Ionic project",
"cordovaPlugins": [
"cordova-plugin-device",
"cordova-plugin-console",
"cordova-plugin-whitelist",
"cordova-plugin-splashscreen",
"cordova-plugin-statusbar",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": []
}
Some update after #suraj input:
I ve updated my package.json such as:
{
"name": "MyIonicProject",
"author": "author name",
"homepage": "",
"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": "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",
"#angular/platform-server": "4.0.0",
"#ionic-native/core": "^3.5.0",
"#ionic-native/device": "^3.5.0",
"#ionic-native/insomnia": "^3.5.0",
"#ionic-native/keyboard": "^3.5.0",
"#ionic-native/network": "^3.5.0",
"#ionic-native/screen-orientation": "^3.5.0",
"#ionic-native/splash-screen": "^3.5.0",
"#ionic-native/sqlite": "^3.5.0",
"#ionic-native/status-bar": "^3.5.0",
"#ionic-native/vibration": "^3.5.0",
"#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",
"ng2-translate": "^3.2.1"
},
"devDependencies": {
"#ionic/app-scripts": "latest",
"typescript": "~2.2.1"
},
"description": "LpjcaIonic: An Ionic project",
"cordovaPlugins": [
"cordova-plugin-device",
"cordova-plugin-console",
"cordova-plugin-whitelist",
"cordova-plugin-splashscreen",
"cordova-plugin-statusbar",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": []
}
I followed the change log update for ionic 3.
I deleted the node_modules directory of my project launching:sudo rm -rf node_modules/ then did an nom install , ionic platform rm ios,ionic platform add ios, and finally ionic build ios.
I looked in the log, here is their content:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'build' ]
2 info using npm#4.5.0
3 info using node#v6.9.1
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle [MyIonicProject]#~prebuild: [MyIonicProject]#
6 silly lifecycle [MyIonicProject]#~prebuild: no script for prebuild, continuing
7 info lifecycle [MyIonicProject]#~build: [MyIonicProject]#
8 verbose lifecycle [MyIonicProject]#~build: unsafe-perm in lifecycle true
9 verbose lifecycle [MyIonicProject]#~build: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/my_mac/Documents/[MyIonicProject]/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/Users/my_mac/Library/Android/sdk:/Users/my_mac/Library/Android/sdk/tools:/Users/my_mac/Library/Android/sdk/platform-tools
10 verbose lifecycle [MyIonicProject]#~build: CWD: /Users/my_mac/Documents/[MyIonicProject]
11 silly lifecycle [MyIonicProject]#~build: Args: [ '-c', 'ionic-app-scripts build' ]
12 silly lifecycle [MyIonicProject]#~build: Returned: code: 1 signal: null
13 info lifecycle [MyIonicProject]#~build: Failed to exec build script
14 verbose stack Error: [MyIonicProject]# build: `ionic-app-scripts build`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:279:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:877:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid LpjcaIonic#
16 verbose cwd /Users/my_mac/Documents/[MyIonicProject]
17 verbose Darwin 16.5.0
18 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
19 verbose node v6.9.1
20 verbose npm v4.5.0
21 error code ELIFECYCLE
22 error errno 1
23 error LpjcaIonic# build: `ionic-app-scripts build`
23 error Exit status 1
24 error Failed at the [MyIonicProject]# build script 'ionic-app-scripts build'.
24 error Make sure you have the latest version of node.js and npm installed.
24 error If you do, this is most likely a problem with the [MyIonicProject] package,
24 error not with npm itself.
24 error Tell the author that this fails on your system:
24 error ionic-app-scripts build
24 error You can get information on how to open an issue for this project with:
24 error npm bugs [MyIonicProject]
24 error Or if that isn't available, you can get their info via:
24 error npm owner ls [MyIonicProject]
24 error There is likely additional logging output above.
25 verbose exit [ 1, true ]
Additional input to #suraj, the class CustomHttpService, it is a service located in [project]/services/custom-http/custom-http.ts and injected in the Providers section of app.module.ts:
import { Injectable } from '#angular/core';
import { Http, Headers, Response, RequestOptions, RequestMethod, Request } from '#angular/http';
import { Observable } from 'rxjs/Observable';
// import { Network } from 'ionic-native';
import { Network } from '#ionic-native/network';
#Injectable()
export class CustomHttpService {
//other code
public connection = () => {
return Network.type;
}
public onDisconnect = ():Observable<any> => {
return Network.onDisconnect();
}
public onConnect = ():Observable<any> => {
return Network.onConnect();
}
}
you have updated ionic-native to 3.x.. however your core ionic-angular is still in 2.0.0-rc0 and also all other dependencies are older.
Typescript used currently is changed to 2.2.
You will need to update your package.json to the current starter app version if you plan to move to ionic native 3.
Also check the changelog for any breaking changes in ionic for your code.
Also you need set each of the ionic native plugins as providers and inject in your constructor and use.
Check the docs.
In your app.module.ts,
#NgModule({
...
providers: [
...
Network
...
]
...
})
export class AppModule { }
In your custom.http.ts
constructor(public http:Http,public network:Network
){
console.log("CustomHttpService() starts");
}
//..other code
public connection = () => {
return this.network.type;
}
Ran into the same error and after filtering through the code there was a syntax error with a missing comma. Try looking in your app.module.ts file. Hope it helps.

Resources