Jakeeyturner / composer-ionic

Mobile application code generation tool for Hyperledger Composer
3 stars 2 forks source link

Error trying to emulate ios or run on ios device #10

Closed DennisM330 closed 6 years ago

DennisM330 commented 6 years ago

Nice job, the app runs fine using npm start or ionic serve

Trying to emulate on ios or running on ios gets a Channel Closed error. Can ignore the Lint messages below. The same Channel Closed error occurs for Android too.

ionic cordova run ios Running app-scripts build: --address 0.0.0.0 --port 8100 --p 8100 --livereload-port 35729 --r 35729 --iscordovaserve --nobrowser

[16:19:16] build dev started ... [16:19:16] clean started ... [16:19:16] clean finished in 5 ms [16:19:16] copy started ... [16:19:16] deeplinks started ... [16:19:17] deeplinks finished in 218 ms [16:19:17] transpile started ... [16:19:21] transpile finished in 3.93 s [16:19:21] preprocess started ... [16:19:21] preprocess finished in less than 1 ms [16:19:21] webpack started ... [16:19:21] copy finished in 4.29 s [16:19:27] webpack finished in 6.70 s [16:19:27] sass started ... Without from option PostCSS could generate wrong source map and will not find Browserslist config. Set it to CSS file path or to undefined to prevent this warning. [16:19:28] sass finished in 1.06 s [16:19:28] postprocess started ... [16:19:28] postprocess finished in 5 ms [16:19:28] lint started ... [16:19:28] build dev finished in 12.04 s [WARN] Error occurred during command execution from a CLI plugin (@ionic/cli-plugin-cordova). Your plugins may be out of date. TypeError: env.runcmd is not a function

MacBook-Pro-28:DigitalPartsProvenanceMobile drmiller$ [16:19:31] tslint: src/app/app.module.ts, line: 26 'ORG_HYPERLEDGER_COMPOSER_SYSTEM' is declared but never used.

  L26:  import * as ORG_HYPERLEDGER_COMPOSER_SYSTEM from './org.hyperledger.composer.system';
  L27:  import * as NET_BIZ_DIGITALPARTSNETWORK from './net.biz.digitalpartsnetwork';

[16:19:31] tslint: src/app/app.module.ts, line: 27 'NET_BIZ_DIGITALPARTSNETWORK' is declared but never used.

  L26:  import * as ORG_HYPERLEDGER_COMPOSER_SYSTEM from './org.hyperledger.composer.system';
  L27:  import * as NET_BIZ_DIGITALPARTSNETWORK from './net.biz.digitalpartsnetwork';

(node:18856) UnhandledPromiseRejectionWarning: Error [ERR_IPC_CHANNEL_CLOSED]: channel closed at process.target.send (internal/child_process.js:588:16) at taskError (/Users/drmiller/Desktop/digitalpartsnetwork/apps/DigitalPartsProvenanceMobile/node_modules/@ionic/app-scripts/dist/worker-process.js:57:13) at /Users/drmiller/Desktop/digitalpartsnetwork/apps/DigitalPartsProvenanceMobile/node_modules/@ionic/app-scripts/dist/worker-process.js:17:13 at (node:18856) 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:18856) [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.

DennisM330 commented 6 years ago

ionic info shows the following versions installed on my system: ionic info

global packages:

@ionic/cli-utils : 1.5.0
Cordova CLI      : 8.0.0 
Ionic CLI        : 3.5.0

local packages:

@ionic/app-scripts : 3.1.9
Cordova Platforms  : ios 4.5.4
Ionic Framework    : ionic-angular 3.7.1

System:

Node       : v8.11.1
OS         : macOS High Sierra
Xcode      : Xcode 8.0 Build version 8A218a 
ios-deploy : not installed
ios-sim    : 5.0.8 
npm        : 5.6.0 
DennisM330 commented 6 years ago

This seems to help to rid of the channel closed error. You may want to update the doc/ReadMe npm uninstall --save-dev @ionic/cli-plugin-cordova npm install --save-dev @ionic/cli-plugin-cordova@1.4.1

See https://github.com/ionic-team/ionic/issues/12561

Jakeeyturner commented 6 years ago

Hi @DennisM330

I haven't been able to run iOS applications due to my development environment, so thank you for creating this issue!

Would you be able to clarify which package you had to uninstall and re-install for iOS to work correctly?

Thanks, Jake

DennisM330 commented 6 years ago

npm uninstall --save-dev @ionic/cli-plugin-cordova npm install --save-dev @ionic/cli-plugin-cordova@1.4.1

After I did that, I can both run on my iPad or use the cordova ios emulator.

Jakeeyturner commented 6 years ago

Did you run this inside a generated mobile applications directory?

Those commands wouldn't do anything, as you're not specifying a node package to uninstall and install. I think you're missing the package name of what you uninstalled and installed as the syntax isn't correct. Or you might have done something else to make it work correctly.

DennisM330 commented 6 years ago

npm uninstall --save-dev @ionic/cli-plugin-cordova npm install --save-dev @ionic/cli-plugin-cordova@1.4.1

Jakeeyturner commented 6 years ago

@DennisM330 Could I see the contents of your 'package.json' file for your working application?

DennisM330 commented 6 years ago

package.txt

DennisM330 commented 6 years ago

I am fully functional now (both ios emulator and running app on my iPad) after just simply staying with the cli cordova plugin version referenced above. Might want to check with ionic to see if there is an issue with later versions of the plugin. Probably not a bug here but maybe an ionic dependancy.

DennisM330 commented 6 years ago

For reference, I had to perform some other updates on my Mac to deploy the app to my iOS devices including xcode and ios-deploy, Ionic Info now shows: ionic info [WARN] Detected locally installed Ionic CLI, but it's too old--using global CLI.

cli packages: (/Users/drmiller/.nvm/versions/node/v8.11.1/lib/node_modules)

@ionic/cli-utils  : 1.19.2
ionic (Ionic CLI) : 3.20.0

global packages:

cordova (Cordova CLI) : 8.0.0 

local packages:

@ionic/app-scripts : 3.1.9
Cordova Platforms  : android 6.4.0 ios 4.5.4
Ionic Framework    : ionic-angular 3.7.1

System:

ios-deploy : 1.9.2 
ios-sim    : 5.0.8 
Node       : v8.11.1
npm        : 5.6.0 
OS         : macOS High Sierra
Xcode      : Xcode 9.3.1 Build version 9E501 

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : pro
Jakeeyturner commented 6 years ago

Thanks @DennisM330

Would you be able to clone this repository and test the new changes I've made for iOS?

Also, if you don't mind and have the time, would you be able to create a guide for configuring your iOS development environment?

DennisM330 commented 6 years ago

I cloned and tested the new changes for iOS. I was able to run the app in both the iOS simulator and on an iPad.

To run in the iOS simulator: ionic cordova emulate ios

Brief directions to run on your iPad

Jakeeyturner commented 6 years ago

Thank you @DennisM330! I'm going to include these instructions in the repositories README.

DennisM330 commented 6 years ago

May want to consider adding these version pre-reqs for MacOS High Sierra ios-deploy : 1.9.2 OS : macOS High Sierra Xcode : Xcode 9.3.1 Build version 9E501