Ionic 2 convert to Ionic 3 : "Error: Failed to transpile program" on "ionic build iOS" - 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.

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?

react-native Unable to resolve module 'warnOnce'

my English is little rusty, I'm sorry for that.
I have an error at the moment when I am starting react-native project on the iOS Simulator.
To rule out any conflict with my code, I started a new project
react-native init demo
react-native start
react-native run-ios --simulator="iPhone 6"
Now is when i get the message error
Loading dependency graph, done.
error: bundling failed: Error: Unable to resolve module `warnOnce` from `node_modules/react-native/Libraries/react-native/react-native-implementation.js`: warnOnce could not be found within the project.
If you are sure the module exists, try these steps:
1. Clear watchman watches: watchman watch-del-all
2. Delete node_modules: rm -rf node_modules and run yarn install
3. Reset Metro's cache: yarn start --reset-cache
4. Remove the cache: rm -rf /tmp/metro-*
at ModuleResolver.resolveDependency (/usr/local/lib/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ModuleResolution.js:186:15)
at ResolutionRequest.resolveDependency (/usr/local/lib/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph/ResolutionRequest.js:52:18)
at DependencyGraph.resolveDependency (/usr/local/lib/node_modules/react-native/node_modules/metro/src/node-haste/DependencyGraph.js:282:16)
at Object.resolve (/usr/local/lib/node_modules/react-native/node_modules/metro/src/lib/transformHelpers.js:267:42)
at /usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:426:31
at Array.map (<anonymous>)
at resolveDependencies (/usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:423:18)
at /usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:275:33
at Generator.next (<anonymous>)
at asyncGeneratorStep (/usr/local/lib/node_modules/react-native/node_modules/metro/src/DeltaBundler/traverseDependencies.js:87:24)
I need to know if anybody have same problem and how fix it ?
My react-native version is 0.61.5
package.json
{
"name": "demo",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"react": "16.9.0",
"react-native": "0.61.4"
},
"devDependencies": {
"#babel/core": "^7.6.2",
"#babel/runtime": "^7.6.2",
"#react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.5.1",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.56.0",
"react-test-renderer": "16.9.0"
},
"jest": {
"preset": "react-native"
}
}
Thank you for advance.
I found the solution.
I was using react-native-cli.
An advice report in the last react-native documentation , inform that react-native-cli may cause unexpected issues.
I removed react-native-cli and now I'm using
npx react-native ...
Thank you and I'm sorry for my horrible English.
Try by editing the your metro.config.js to
const blacklist = require('metro-config/src/defaults/blacklist');
module.exports = {
resolver: {
blacklistRE: blacklist([
/node_modules\/.*\/node_modules\/react-native\/.*/,
])
},
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
};
Refer the thread and answer

Nativescript-Dev-Appium Setup

I am trying to implement nativescript-dev-appium in an existing nativescript-angular project and am having a lot of trouble getting the plugin configured.
The simulator appears to be found but the run fails in the before all and after all hooks because it appears to not have a device instance.
walrus:demo-appium niirds$ npm run e2e -- --runType sim.iPhoneX --verbose
> # e2e /Users/niirds/mobi/demo-appium
> node ./node_modules/nativescript-dev-appium/check-dev-deps.js && tsc -p e2e && mocha --opts ./e2e/config/mocha.opts "--runType" "sim.iPhoneX" "--verbose"
/Users/niirds/mobi/demo-appium/e2e/config/appium.capabilities.json
Capabilities found at: /Users/niirds/mobi/demo-appium/e2e/config/appium.capabilities.json
Appium will use default automation name
Available applications: ["platforms/ios/build/emulator/demoappium.app"]
Pick first application: "platforms/ios/build/emulator/demoappium.app"
Application full path: /Users/niirds/mobi/demo-appium/platforms/ios/build/emulator/demoappium.app
Found devices: [ { token: 'C8B1990E-1593-49A8-AA68-C7E5CC2134BB',
name: 'iPhone X',
status: 'booted',
type: 'watch',
apiLevel: '12.2',
platform: 'ios',
config: { density: 3, offsetPixels: 87 } } ]
1) "before all" hook: start server
2) "after all" hook: stop server
0 passing (2s)
2 failing
1) "before all" hook: start server:
TypeError: Cannot read property 'type' of undefined
at DeviceManager.<anonymous> (node_modules/nativescript-dev-appium/lib/device-manager.js:82:28)
at Generator.next (<anonymous>)
at fulfilled (node_modules/nativescript-dev-appium/lib/device-manager.js:4:58)
at process._tickCallback (internal/process/next_tick.js:68:7)
2) "after all" hook: stop server:
TypeError: Cannot read property 'platform' of undefined
at Function.<anonymous> (node_modules/mobile-devices-controller/lib/device-controller.js:104:24)
at Generator.next (<anonymous>)
at /Users/niirds/mobi/demo-appium/node_modules/mobile-devices-controller/lib/device-controller.js:7:71
at new Promise (<anonymous>)
at __awaiter (node_modules/mobile-devices-controller/lib/device-controller.js:3:12)
at Function.uninstallApp (node_modules/mobile-devices-controller/lib/device-controller.js:103:16)
at Object.<anonymous> (node_modules/nativescript-dev-appium/index.js:85:64)
at Generator.next (<anonymous>)
at /Users/niirds/mobi/demo-appium/node_modules/nativescript-dev-appium/index.js:7:71
at new Promise (<anonymous>)
at __awaiter (node_modules/nativescript-dev-appium/index.js:3:12)
at Object.stopServer (node_modules/nativescript-dev-appium/index.js:77:12)
at Object.<anonymous> (e2e/setup.js:16:37)
at Generator.next (<anonymous>)
at /Users/niirds/mobi/demo-appium/e2e/setup.js:7:71
at new Promise (<anonymous>)
at __awaiter (e2e/setup.js:3:12)
at Context.after (e2e/setup.js:15:28)
at process.topLevelDomainCallback (domain.js:121:23)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! # e2e: `node ./node_modules/nativescript-dev-appium/check-dev-deps.js && tsc -p e2e && mocha --opts ./e2e/config/mocha.opts "--runType" "sim.iPhoneX" "--verbose"`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the # e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Here is the simulator capability, provided by the installation:
"sim.iPhoneX": {
"platformName": "iOS",
"platformVersion": "/12*/",
"deviceName": "iPhone X",
"noReset": false,
"fullReset": false,
"app": ""
},
I have xcode 10.2 installed, and here is the package.json if that helps.
{
"nativescript": {
"id": "org.nativescript.demoappium",
"tns-android": {
"version": "5.3.0"
},
"tns-ios": {
"version": "5.3.0"
}
},
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"repository": "<fill-your-repository-here>",
"scripts": {
"lint": "tslint \"src/**/*.ts\"",
"e2e": "node ./node_modules/nativescript-dev-appium/check-dev-deps.js && tsc -p e2e && mocha --opts ./e2e/config/mocha.opts ",
"e2e-watch": "tsc -p e2e --watch"
},
"dependencies": {
"#angular/animations": "~7.2.0",
"#angular/common": "~7.2.0",
"#angular/compiler": "~7.2.0",
"#angular/core": "~7.2.0",
"#angular/forms": "~7.2.0",
"#angular/http": "~7.2.0",
"#angular/platform-browser": "~7.2.0",
"#angular/platform-browser-dynamic": "~7.2.0",
"#angular/router": "~7.2.0",
"nativescript-angular": "~7.2.0",
"nativescript-theme-core": "~1.0.4",
"reflect-metadata": "~0.1.12",
"rxjs": "~6.3.0",
"tns-core-modules": "~5.3.0",
"zone.js": "~0.8.26"
},
"devDependencies": {
"#angular/compiler-cli": "~7.2.0",
"#nativescript/schematics": "~0.5.0",
"#ngtools/webpack": "~7.2.0",
"#types/chai": "~4.1.7",
"#types/mocha": "~5.2.5",
"#types/node": "~10.12.18",
"codelyzer": "~4.5.0",
"mocha": "~5.2.0",
"mocha-junit-reporter": "~1.18.0",
"mocha-multi": "~1.0.1",
"nativescript-dev-appium": "^5.1.0",
"nativescript-dev-sass": "~1.7.0",
"nativescript-dev-typescript": "~0.9.0",
"nativescript-dev-webpack": "~0.21.0",
"tslint": "~5.11.0"
},
"gitHead": "6ccaee804c71761be1c2f91d0b2dd67c8ba6d2b6",
"readme": "NativeScript Application"
}
Steps to reproduce:
1. create sample nativescript-angular app--i used the tab navigation one for this test.
2. install nativescript-dev-appium: npm i -D nativescript-dev-appium
3. install other dependencies https://docs.nativescript.org/angular/tooling/testing/end-to-end-testing/overview#environment-setup
4. build app: tns build <platform>
5. run test: `npm run e2e -- --runType
i have been trying to get this to work on iOS for now.
Any help will be greatly appreciated!
I think that for some reason the device type that device controller has returned type: 'watch' is not correct.
I suggest you change the config to something like:
"sim.iPhoneX": {
"platformName": "iOS",
"platformVersion": "12.2",
"deviceName": "iPhone X",
"noReset": false,
"fullReset": false,
"app": ""
},
or simply try it with the --ignoreDeviceController option.

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

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

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