Can't add iOS platform to ionic app, Mac OS - ios

I am trying to add iOS platform to my ionic 1 app but I get errors. How can I go further to build my app?
$ cordova platform add ios --save
Using cordova-fetch for cordova-ios#~4.3.1
(node:14587) UnhandledPromiseRejectionWarning: CordovaError: Failed to fetch platform cordova-ios#~4.3.1
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 254 Error output:
npm WARN #ionic-native/globalization#3.14.0 requires a peer of #ionic-native/core#^3.6.0 but none is installed. You must install peer dependencies yourself.
npm WARN #ionic-native/globalization#3.14.0 requires a peer of #angular/core#* but none is installed. You must install peer dependencies yourself.
npm WARN #ionic-native/globalization#3.14.0 requires a peer of rxjs#^5.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN The package gulp is included as both a dev and production dependency.
npm ERR! path /Users/louisro/Documents/BoardLine/node_modules/npm/node_modules/ansistyles
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/Users/louisro/Documents/BoardLine/node_modules/npm/node_modules/ansistyles' -> '/Users/louisro/Documents/BoardLine/node_modules/npm/node_modules/.ansistyles.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/louisro/.npm/_logs/2018-04-16T21_04_03_502Z-debug.log
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/platform/addHelper.js:312:25
at _rejected (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:797:24)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/q/q.js:823:30
at Promise.when (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:1142:31)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:808:41)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:624:44
at runSingle (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:137:13)
at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:125:13)
at process._tickCallback (internal/process/next_tick.js:176:11)
(node:14587) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:14587) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Here's my package.json:
{
"name": "my app",
"app_id": "bc689f",
"version": "1.0.0",
"description": "newIonic: An Ionic project",
"dependencies": {
"#ionic-native/globalization": "^3.2.0",
"#ionic/cloud": "^0.9.0",
"bluebird": "^3.4.6",
"cc.fovea.cordova.purchase": "~6.1.2",
"cordova-android": "~6.2.3",
"cordova-ios": "~4.3.1",
"cordova-plugin-admobpro": "~2.29.0",
"cordova-plugin-app-version": "~0.1.9",
"cordova-plugin-compat": "~1.1.0",
"cordova-plugin-console": "~1.0.7",
"cordova-plugin-datepicker": "https://github.com/VitaliiBlagodir/cordova-plugin-datepicker.git",
"cordova-plugin-device": "~1.1.6",
"cordova-plugin-extension": "~1.5.1",
"cordova-plugin-facebook4": "~1.9.1",
"cordova-plugin-geolocation": "~2.4.3",
"cordova-plugin-globalization": "~1.0.7",
"cordova-plugin-google-analytics": "~1.8.2",
"cordova-plugin-googleplus": "~5.1.1",
"cordova-plugin-network-information": "~1.3.3",
"cordova-plugin-splashscreen": "~4.0.3",
"cordova-plugin-statusbar": "~2.2.3",
"cordova-plugin-whitelist": "~1.3.2",
"cordova-plugin-x-socialsharing": "~5.1.8",
"gulp": "^3.5.6",
"gulp-concat": "^2.2.0",
"gulp-minify-css": "^0.3.0",
"gulp-rename": "^1.2.0",
"gulp-sass": "^2.0.4",
"ionic-app-lib": "^2.2.0",
"ionic-plugin-deploy": "~0.6.7",
"ionic-plugin-keyboard": "~2.2.1",
"onesignal-cordova-plugin": "~2.1.2"
},
"devDependencies": {
"#ionic/cli-plugin-cordova": "1.4.0",
"#ionic/cli-plugin-gulp": "1.0.1",
"#ionic/cli-plugin-ionic1": "2.0.0",
"bower": "^1.3.3",
"gulp": "^3.9.1",
"gulp-replace-task": "^0.11.0",
"gulp-util": "^3.0.7",
"shelljs": "^0.3.0",
"yargs": "^5.0.0"
},
"cordovaPlugins": [
{
"locator": "https://github.com/VitaliiBlagodir/cordova-plugin-datepicker.git",
"id": "cordova-plugin-datepicker"
},
"ionic-plugin-deploy",
"cordova-plugin-extension",
"cordova-plugin-admobpro",
"cc.fovea.cordova.purchase",
"onesignal-cordova-plugin",
"cordova-plugin-geolocation",
"cordova-plugin-device",
"cordova-plugin-network-information",
"cordova-plugin-compat",
"cordova-plugin-app-version",
"cordova-plugin-console",
"cordova-plugin-globalization",
"cordova-plugin-google-analytics",
"cordova-plugin-googleplus",
"cordova-plugin-splashscreen",
"cordova-plugin-statusbar",
"cordova-plugin-whitelist",
"cordova-plugin-x-socialsharing",
"ionic-plugin-keyboard",
{
"id": "cordova-plugin-facebook4",
"locator": "cordova-plugin-facebook4",
"variables": {
"APP_ID": "3996261696416",
"APP_NAME": "my app"
}
}
],
"cordovaPlatforms": [
"android#6.1.0",
{
"platform": "android",
"version": "",
"locator": "android"
}
],
"main": "gulpfile.js",
"scripts": {},
"repository": {
"type": "git",
"url": "git+https://#bitbucket.org/linedevs/myapp.git"
},
"author": "",
"license": "ISC",
"homepage": "https://bitbucket.org/linedevs/myapp#readme",
"cordova": {
"platforms": [
"android",
"ios"
],
"plugins": {
"cc.fovea.cordova.purchase": {
"BILLING_KEY": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAiqWZvb/CV3MWjSvTwRXrD3lt2BG8BGMoFjz8ZyBTkc"
},
"cordova-plugin-admobpro": {},
"cordova-plugin-app-version": {},
"cordova-plugin-compat": {},
"cordova-plugin-console": {},
"cordova-plugin-datepicker": {},
"cordova-plugin-device": {},
"cordova-plugin-extension": {},
"cordova-plugin-facebook4": {
"APP_ID": "___",
"APP_NAME": "my app"
},
"cordova-plugin-geolocation": {
"GEOLOCATION_USAGE_DESCRIPTION": "Line wants to offer the best experience."
},
"cordova-plugin-globalization": {},
"cordova-plugin-google-analytics": {},
"cordova-plugin-googleplus": {
"REVERSED_CLIENT_ID": "com.googleusercontent.apps.10ji"
},
"cordova-plugin-network-information": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-x-socialsharing": {},
"ionic-plugin-deploy": {},
"ionic-plugin-keyboard": {},
"onesignal-cordova-plugin": {}
}
}
}
And my ionic info:
$ ionic info
[WARN] Error with ./www/lib/ionic/version.json file: FILE_NOT_FOUND, trying
./bower.json.
cli packages: (/usr/local/lib/node_modules)
#ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
Gulp CLI : CLI version 3.9.1 Local version 3.9.1
local packages:
Cordova Platforms : none
Ionic Framework : ionic1 1.3.2
System:
Node : v9.11.1
npm : not installed
OS : macOS Sierra
Environment Variables:
ANDROID_HOME : /home/louis/android-sdk-linux/
Misc:
backend : pro

First update the NPM
$npm update -g
then remove and add ios platform
$ionic cordova platform rm ios && ionic cordova platform add ios

this did the trick: https://stackoverflow.com/a/45491459/2217647
updating npm allowed $ cordova platform add ios to work.

Try this command instead of just using cordova.
Use this command $ionic cordova platform add ios --save.
And try updating the node modules and npm

Related

Migrating ngFileSaver from bower to node package breaks

I have an Angular 1.6 project which did build using:
node 10.16.0
bower 1.8.14
gulp 3.9.1
and with the command sequence:
npm install
bower install
gulp
It now breaks at the bower install step with the file-saver.js#~1.20150507.2 throwing error:
Failed to execute "git ls-remote --tags --heads https://github.com/Teleborder/FileSaver.js.git", exit code of #128
Because of this, I have removed the line
"angular-file-saver": "^1.1.3"
from the bower.json file (bower uninstall did not work for that package) and installed the angular-file-saver package via
npm install angular-file-saver --save-dev
So now the package.json looks like this:
{
"name": "app",
"version": "1.0.0",
"description": "app",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"app"
],
"author": "me",
"license": "ISC",
"devDependencies": {
"angular-file-saver": "^1.1.3",
"del": "^2.2.2",
"eslint-config-angular": "^0.5.0",
"eslint-plugin-angular": "^1.5.0",
"gulp": "^3.9.1",
"gulp-angular-filesort": "^1.1.1",
"gulp-angular-templatecache": "^2.0.0",
"gulp-autoprefixer": "^3.1.1",
"gulp-cheerio": "^0.6.2",
"gulp-clean-css": "^2.2.2",
"gulp-concat": "^2.6.1",
"gulp-eslint": "^3.0.1",
"gulp-filter": "^4.0.0",
"gulp-flatten": "^0.3.1",
"gulp-htmlmin": "^3.0.0",
"gulp-if": "^2.0.2",
"gulp-inject": "^4.1.0",
"gulp-ng-annotate": "^2.0.0",
"gulp-rev": "^7.1.2",
"gulp-sass": "^3.0.0",
"gulp-sourcemaps": "^1.9.1",
"gulp-string-replace": "^0.3.1",
"gulp-uglify": "^2.0.0",
"main-bower-files": "^2.13.1",
"natives": "^1.1.6",
"require-dir": "^0.3.1",
"rimraf": "^2.6.2",
"stream-series": "^0.1.1",
"uglify-save-license": "^0.4.1",
"yargs": "^6.5.0"
},
"dependencies": {
"bower": "^1.8.4"
}
}
My src\app.js contains this:
(function(angular) {
'use strict';
angular
.module('app', [
'angular-cache',
'ui.router',
'ui.router.modal',
'ui.bootstrap',
'ui.bootstrap-slider',
'ui.validate',
'angular-confirm',
'ngAnimate',
'ngFileSaver',
'angularMoment',
'pascalprecht.translate',
'tmh.dynamicLocale']);
}(window.angular));
And my controller contains this:
angular
.module('app')
.component('readings', {
controllerAs: 'vm',
templateUrl: 'readings/readings.html',
controller: ReadingsController
});
function ReadingsController(..., FileSaver, ...) {
So, now this command sequence works:
npm install
bower install
gulp
But I get this error in the browser
Uncaught Error: [$injector:modulerr] Failed to instantiate module app due to:
Error: [$injector:modulerr] Failed to instantiate module ngFileSaver due to:
Error: [$injector:nomod] Module 'ngFileSaver' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
http://errors.angularjs.org/1.6.0/$injector/nomod?p0=ngFileSaver
How can I get this package working via npm instead of bower?

tfx extension create failed while running npm script

I'm using this package to compile and build my extension
{
"id": "extensionAzureDevOps",
"name": "extension",
"publisher": "ME",
"version": "0.0.63",
"description": "Azure DevOps Extension",
"keywords": [
"extensions",
"Azure DevOps",
"Visual Studio Team Services"
],
"engines": {
"vscode": "^1.8.0"
},
"license": "MIT",
"repository": {
"type": "git",
"url": ""
},
"scripts": {
"clean": "rimraf ./dist",
"compile": "npm run clean && npm run test && webpack --mode production",
"compile:dev": "npm run clean && npm run test && webpack --mode development",
"build": "npm run compile",
"build:dev": "npm run compile:dev && npm run postbuild",
"postbuild": "npm run package-extension -- --rev-version",
"package-extension": "tfx extension create --manifest-globs azure-devops-extension.json src/TabExtension/*.json",
"publish-extension": "tfx extension publish --manifest-globs azure-devops-extension.json src/TabExtension/*.json",
"test": "set TEST_REPORT_FILENAME=test-results.xml && jest --verbose"
},
"dependencies": {
"#fluentui/react": "^8.36.3",
"azure-devops-extension-api": "~1.157.0",
"azure-devops-extension-sdk": "~2.0.11",
"azure-devops-ui": "~2.164.0",
"react": "~16.13.1",
"react-dom": "~16.13.1"
},
"devDependencies": {
"#testing-library/jest-dom": "^5.11.0",
"#testing-library/react": "^10.4.4",
"#types/jest": "^26.0.3",
"#types/react": "~16.8.2",
"#types/react-dom": "~16.8.0",
"copy-webpack-plugin": "^7.0.0",
"base64-inline-loader": "~1.1.1",
"css-loader": "~1.0.0",
"jest": "^26.1.0",
"jest-junit-reporter": "^1.1.0",
"node-sass": "^5.0.0",
"rimraf": "~2.6.2",
"sass-loader": "~10.0.5",
"style-loader": "~0.23.1",
"tfx-cli": "^0.6.3",
"ts-jest": "^26.1.1",
"ts-loader": "~5.2.2",
"typescript": "^3.9.6",
"webpack": "^5.23.0",
"webpack-cli": "^4.5.0"
},
"jest": {
"transform": {
"^.+\\.(js|ts|tsx|jsx)$": "ts-jest"
},
"transformIgnorePatterns": [
"node_modules/(?!(react-native|azure-devops-ui|azure-devops-extension-sdk)/)"
],
"moduleNameMapper": {
"\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/src/__mocks__/fileMock.js",
"\\.(css|less|scss)$": "<rootDir>/src/__mocks__/styleMock.js"
},
"preset": "ts-jest/presets/js-with-babel",
"testResultsProcessor": "./node_modules/jest-junit-reporter",
"collectCoverage": true,
"coverageReporters": [
"json",
"html",
"cobertura"
],
"globals": {
"ts-jest": {
"tsconfig": "tsconfig.test.json"
}
}
}
}
When I run the command npm run postbuild, I receive this error:
tfx extension create --manifest-globs azure-devops-extension.json src/TabExtension/*.json "--rev-version"
tfx extension create --manifest-globs azure-devops-extension.json src/TabExtension/*.json "--rev-version"
(node:89172) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
TFS Cross Platform Command Line Interface v0.6.4
Copyright Microsoft Corporation
error: TypeError [ERR_INVALID_ARG_TYPE]: The "data" argument must be of type string or an instance of Buffer, TypedArray, or DataView. Received an instance of Inplace
npm ERR! code ELIFECYCLE
npm ERR! errno 4294967295
npm ERR! feedback-extension-for-azuredevops#0.0.63 package-extension: `tfx extension create --manifest-globs azure-devops-extension.json src/TabExtension/*.json "--rev-version"`
npm ERR! Exit status 4294967295
npm ERR!
npm ERR! Failed at the feedback-extension-for-azuredevops#0.0.63 package-extension script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\t-nashak\AppData\Roaming\npm-cache\_logs\2021-12-08T15_15_13_712Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 4294967295
npm ERR! feedback-extension-for-azuredevops#0.0.63 postbuild: `npm run package-extension -- --rev-version`
npm ERR! Exit status 4294967295
npm ERR!
But when I run the command tfx extension create --manifest-globs azure-devops-extension.json src/TabExtension/*.json --rev-version it works well
what causes the dependencies cycle? how can I fix it?
note: if I remove the param --rev-version it will work well
I had the same issue. I guess the postbuild command is wrong:
"postbuild": "npm run package-extension -- --rev-version"
This works:
"postbuild": "npm run package-extension --rev-version"

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.

How to prevent Bower from hanging up when installing angular-ui-tree?

I've been trying to install angular-ui-tree using bower version 1.8.0, but it keeps hanging up on me.
I've tried the following commands:
bower install angular-ui-tree
bower install angular-ui-tree --save
bower install angular-ui-tree --save --verbose
bower install angular-ui-tree --verbose
Verbose doesn't print a stack trace, however all commands above print the info of already installed packages.
I've also tried using bower init or restoring previous versions of bower.json, but to no avail.
The original bower.json file:
{
"name": "meten",
"version": "0.0.1",
"dependencies": {
"angular": "*",
"bootstrap": "*",
"angular-animate": "*",
"angular-bootstrap": "*",
"angular-cookies": "*",
"angular-resource": "*",
"angular-route": "*",
"angular-sanitize": "*",
"angular-smart-table": "*",
"angular-touch": "*",
"angular-strap": "*",
"angular-nvd3": "*",
"papaparse": "*",
"components-font-awesome": "^4.7.0"
},
"devDependencies": {
"angular-mocks": "*"
},
"appPath": "app",
"moduleName": "metenApp",
"overrides": {
"bootstrap": {
"main": [
"less/bootstrap.less",
"dist/css/bootstrap.css",
"dist/js/bootstrap.js"
]
}
}
}
What can I do to fix bower?

Run shell script failed when I use Xcode to build project with release deployment.

Issue Description
The log of error when build project looks like below.
node /Users/niyao/Company/Projects/EVE/EVERN/node_modules/react-native/local-cli/cli.js bundle --entry-file index.ios.js --platform ios --dev false --reset-cache --bundle-output /Users/niyao/Library/Developer/Xcode/DerivedData/EVE-bzggtbnrxixkvwgqyewmpxepvljo/Build/Products/Release-iphonesimulator/EVE.app/main.jsbundle --assets-dest /Users/niyao/Library/Developer/Xcode/DerivedData/EVE-bzggtbnrxixkvwgqyewmpxepvljo/Build/Products/Release-iphonesimulator/EVE.app
fs.js:584
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
Error: ENOENT: no such file or directory, open 'package.json'
Error Scenario
After I use package.json as below to npm instal new version, the error happens within release deployment scheme.
{
"name": "NYProject",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"lint": "./node_modules/eslint/bin/eslint.js index.ios.js index.android.js react/",
"watch": "npm-watch"
},
"watch": {
"lint": {
"patterns": [
"react",
"index.ios.js",
"index.android.js"
],
"extensions": "js",
"ignore": ".node_modules",
"quiet": false
}
},
"dependencies": {
"react": "15.3.1",
"react-native": "^0.32.0",
"react-redux": "^4.4.5",
"redux": "^3.5.2",
"redux-logger": "^2.6.1",
"redux-thunk": "^2.1.0"
},
"devDependencies": {
"babel-eslint": "^6.1.2",
"eslint": "^3.3.1",
"eslint-plugin-react": "^6.1.2",
"eslint-plugin-react-native": "^2.0.0",
"npm-watch": "^0.1.6"
}
}
The shell runs failed when build project within Release build configuration.
"./NYProject/node_modules/react-native/packager/react-native-xcode.sh"
Expected Results
Xcode could run shell when build the project. Before I upgrade the package.json configuration, it did run successfully.
Additional Information
React Native version:
react-native-cli: 0.2.0
react-native: 0.32.0
Platform(s) (iOS, Android, or both?):
Xcode 7.3.1 iOS
Operating System (macOS, Linux, or Windows?):
OS X 10.11
I had the same issue, and for me, simply upgrading to react-native 0.33.0 solved the problem.

Resources