ionic-team / ionic-cli

The Ionic command-line interface
MIT License
1.99k stars 652 forks source link

ionic run anroid - command is successfully executed, but ionic is not trying to install the apk on phone with node v5.8.0 #920

Closed petervojtek closed 6 years ago

petervojtek commented 8 years ago

Hello,

I have ionic 2 project and ionic run anroid seems to end up prematurely, but its exit status is 0 and no errors are displayed. My steps:

i fetch the sample project via ionic start MyIonic2Project tutorial --v2.

I add anroid platform, it performs successfully:

$ ionic platform add android
Adding android project...
Creating Cordova project for the Android platform:
    Path: platforms/android
    Package: io.ionic.starter
    Name: V2 Test
    Activity: MainActivity
    Android target: android-22
Copying template files...
Android project created with cordova-android@4.1.1
Saving platform to package.json file

I connect smartphone and run ionic run android and this is the output:

$ ionic run android
WARN: ionic.config.js has been deprecated, you can remove it. 

Running 'run:before' gulp task before run 
[12:07:03] Starting 'clean'...
[12:07:03] Finished 'clean' after 18 ms
[12:07:03] Starting 'build'...
[12:07:03] Starting 'sass'...
[12:07:03] Starting 'html'...
[12:07:03] Starting 'fonts'...
[12:07:03] Starting 'scripts'...
[12:07:03] Finished 'scripts' after 78 ms
[12:07:03] Finished 'html' after 104 ms
[12:07:03] Finished 'fonts' after 124 ms
[12:07:05] Finished 'sass' after 1.53 s

[12:07:31] Finished 'build' after 28 s
[12:07:31] Starting 'run:before'...
[12:07:31] Finished 'run:before' after 8.6 μs

and that is all. the ionic run android command exit status is 0, and ionic made no attempt to build the apk and upload it to the smartphone.

What is suspicious to me is that the directory platforms/android has only 2.8MB and 211 items. Other ionic projects i played with had this directory much larger (hundreds of MB).

nodejs: 5.8.0., npm: 3.7.3, ubuntu 14.04 32bit, ionic version 2.0.0-beta.22

Update: When I downgrade nodejs version from 5.8.0 to v0.12.7, it builds and deploys the apk to android smartphone properly.

tlancina commented 8 years ago

Hey there, thanks for the issue. Does running cordova run android fail as well?

petervojtek commented 8 years ago

hi @tlancina , cordova run android has the same behaviour -- no attempt to build the apk and deploy it to android device but exit status is 0.

$ cordova run android
# no output to console

cordova version: 5.3.3

I guess I should report this to cordova because it is not ionic issue?

jgw96 commented 8 years ago

Hello @petervojtek ! Did you get a chance to talk to the cordova team about this?

petervojtek commented 8 years ago

hi @jgw96 , no as I did not received response for my last question.

However now I tried to find a way how to submit issue to apache cordova jira, but the help page says "click the blue "Create" button at the top of the Cordova JIRA page to create an issue."

However as a logger user, I see there only red Create button and by clicking it I am allowed to create only "Create Service Desk Request'.

jgw96 commented 8 years ago

@petervojtek ahh OK sorry about that. So I'm guessing you have all the Android tools installed on your machine correct? Android tools being adb, fast boot etc?

petervojtek commented 8 years ago

@jgw96 , I hope my environment is setup properly regarding android deployment because when I use nodejs v0.12.7, I can run cordova run android successfully and the ionic app is deployed to android smartphone.

After then when I switch nodejs version (via nvm) to v5.8.0, cordova run android command provides no output and finishes immidiately, with exit status 0.

I do no other changes to the enviroment, only change nodejs using nvm.

jgw96 commented 8 years ago

hmmm sounds like it is set up correctly then. Does it only happen with this app? Or does it happen with any ionic app?

petervojtek commented 8 years ago

So far I played with two Ionic 2 apps and I experience the issue with both of them:

jgw96 commented 8 years ago

@petervojtek Would you mind running ionic start TestProject blank --v2 and then trying to run this on your android device? I am trying to narrow it down to an issue with the tutorial template. Thanks!

petervojtek commented 8 years ago

@jgw96 , here is outcome for your request:

peter@ubuntu:~/repos$ nvm list
->      v0.12.7
         v5.8.0
         system
default -> 0.12.7 (-> v0.12.7)
node -> stable (-> v5.8.0) (default)
stable -> 5.8 (-> v5.8.0) (default)
iojs -> N/A (default)

peter@ubuntu:~/repos$ nvm use stable
Now using node v5.8.0 (npm v3.7.3)

peter@ubuntu:~/repos$ ionic start TestProject blank --v2

One awesome Ionic app coming right up...

Creating Ionic app in folder /home/peter/repos/TestProject based on blank project
Downloading: https://github.com/driftyco/ionic2-app-base/archive/master.zip
[=============================]  100%  0.0s
Downloading: https://github.com/driftyco/ionic2-starter-blank/archive/master.zip
Installing npm packages...

Adding initial native plugins
[=============================]  100%  0.0s

Saving your Ionic app state of platforms and plugins
Saved platform
Saved plugins
Saved package.json

♬ ♫ ♬ ♫  Your Ionic app is ready to go! ♬ ♫ ♬ ♫

Make sure to cd into your new app directory:
  cd TestProject

To run your app in the browser (great for initial development):
  ionic serve

To run on iOS:
  ionic run ios

To run on Android:
  ionic run android

To test your app on a device easily, try Ionic View:
  http://view.ionic.io

New! Add push notifications, update your app remotely, and package iOS and Android apps with the Ionic Platform!
https://apps.ionic.io/signup

New to Ionic? Get started here: http://ionicframework.com/docs/v2/getting-started

peter@ubuntu:~/repos$ cd TestProject/

peter@ubuntu:~/repos/TestProject$ ionic platform add android
Adding android project...
Creating Cordova project for the Android platform:
    Path: platforms/android
    Package: com.ionicframework.testproject896631
    Name: TestProject
    Activity: MainActivity
    Android target: android-22
Copying template files...
Android project created with cordova-android@4.1.1
Saving platform to package.json file

peter@ubuntu:~/repos/TestProject$ ionic run android

Running 'run:before' gulp task before run 
[21:33:45] Starting 'clean'...
[21:33:45] Finished 'clean' after 38 ms
[21:33:45] Starting 'build'...
[21:33:45] Starting 'sass'...
[21:33:45] Starting 'html'...
[21:33:45] Starting 'fonts'...
[21:33:45] Starting 'scripts'...
[21:33:45] Finished 'html' after 102 ms
[21:33:45] Finished 'scripts' after 97 ms
[21:33:45] Finished 'fonts' after 135 ms
[21:33:46] Finished 'sass' after 1.36 s
[21:34:03] Finished 'build' after 18 s
[21:34:03] Starting 'run:before'...
[21:34:03] Finished 'run:before' after 10 μs

peter@ubuntu:~/repos/TestProject$ echo $?
0
jgw96 commented 8 years ago

@petervojtek Thanks for working with me and thanks for your patience (: Would you mind deleting your node_modules folder in the project we just created above, and then run npm install again while using node 5.8.0 please?

petervojtek commented 8 years ago

here is the full shell output of rm -r node_modules/ && npm install

sjaanus commented 8 years ago

I have the same exact issue.

jdmadriz commented 6 years ago

For me, it was a missing dependency on the package.json

ionitron-bot[bot] commented 6 years ago

Thanks for the issue! This issue appears to be associated with an old version of the Ionic CLI. Please update to the latest CLI version, which supports all versions of the Ionic Framework. If the issue is relevant and if it persists after updating to the latest CLI version, please create a new issue.

Thank you for using Ionic!