CLI is very slow lately

Lately, my CLI is very (!) slow. When I type a command and press Enter, it takes about 30 - 120 seconds until the command is even started working on. The performance is especially bad, when I run ionic cordova run android. This takes up to 10mins which is really frustrating.

I already tried npm rebuild node-sass, however, this didn’t improve the performance.

I’m using the command line tool Cmder on Windows 10. However, the same issue occurs when I use Git Bash instead.

Ionic Info gives me:

global packages:

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

local packages:

    @ionic/app-scripts              : 2.1.0
    @ionic/cli-plugin-cordova       : 1.4.1
    @ionic/cli-plugin-ionic-angular : 1.3.2
    Cordova Platforms               : android 6.2.3
    Ionic Framework                 : ionic-angular 3.5.3

System:

    Node       : v6.11.1
    OS         : Windows 10
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
    npm        : 3.10.10

Would be happy about any suggestion what this could be about…

@JayKay
update your node to latest

1 Like

Thanks, @MarcusIII. However, v6.11.1 is the latest LTS version. Hence, you would recommend to use the “current” version, instead of LTS? I once read it would be recommended to use the LTS version…

No not latest LTS just latest node 8 and npm 5
i’m using it and my team, we didn’t have any issues with it

check other people experience
https://forum.ionicframework.com/t/node-8-and-npm-5-are-out-your-experience-with-ionic/92452

Which commands exactly are slow? Also ionic info?
Type ionic info --verbose and try to time the output - what takes how long?

downgrade cordova it will be fast :innocent:

@MarcusIII: Thanks for the suggestion. I upgraded to the latest Node v8 and npm v 5. However, the performance didn’t improve significantly.


@Sujan12: ionic info --verbose is fairly quick - no issues here.

ionic serve takes a little more than 2 minutes.
It becomes really bad when running on a device: ionic run android --prod takes about 10:30 minutes.

Details: ionic serve
Nothing happens on the console for ~15 seconds. Then:

[INFO] Starting app-scripts server: --port 8100 --p 8100 --livereload-port 35729
       --r 35729 --address 0.0.0.0 - Ctrl+C to cancel
[11:34:42]  watch started ...
[11:34:42]  build dev started ...
[11:34:42]  clean started ...
[11:34:42]  clean finished in 2 ms
[11:34:42]  copy started ...
[11:34:42]  transpile started ...

nothing for ~35 seconds, then:

[11:35:16]  transpile finished in 34.13 s
[11:35:16]  preprocess started ...
[11:35:17]  deeplinks started ...
[11:35:17]  deeplinks finished in 280 ms
[11:35:17]  preprocess finished in 520 ms
[11:35:17]  webpack started ...

nothing for ~20 seconds, then:

[11:35:37]  copy finished in 55.24 s

nothing for ~40 seconds, then:

[11:36:17]  webpack finished in 60.63 s
[11:36:17]  sass started ...

nothing for ~15 seconds, then:

[11:36:33]  sass finished in 15.76 s
[11:36:33]  postprocess started ...
[11:36:33]  postprocess finished in 23 ms
[11:36:33]  lint started ...
[11:36:33]  build dev finished in 111.13 s
[11:36:35]  watch ready in 112.87 s
[11:36:35]  dev server running: http://localhost:8100/

Details: ionic run android --prod
Nothing happens on the console for 2 minutes. Then (you can see the timestamp and, hence, the duration):

$ ionic cordova run android --prod
Running app-scripts build: --prod --address 0.0.0.0 --port 8100 --p 8100 --livereload-port 35729 --r 35729 --iscordovaserve --externalIpRequired --nobrowser
[11:52:21]  build prod started ...
[11:52:21]  clean started ...
[11:52:21]  clean finished in 5 ms
[11:52:21]  copy started ...
[11:52:21]  ngc started ...
[11:52:57]  ngc finished in 35.90 s
[11:52:57]  preprocess started ...
[11:52:57]  deeplinks started ...
[11:52:58]  deeplinks finished in 963 ms
[11:52:58]  optimization started ...
[11:53:11]  copy finished in 49.80 s
[11:53:45]  optimization finished in 47.38 s
[11:53:45]  preprocess finished in 48.35 s
[11:53:45]  webpack started ...
[11:54:14]  webpack finished in 28.87 s
[11:54:14]  sass started ...
[11:54:14]  uglifyjs started ...
[11:54:25]  sass finished in 10.85 s
[11:54:25]  cleancss started ...
[11:54:29]  cleancss finished in 4.46 s
[11:54:56]  uglifyjs finished in 42.24 s
[11:54:56]  postprocess started ...
[11:54:56]  postprocess finished in 32 ms
[11:54:56]  lint started ...
[11:54:56]  build prod finished in 155.64 s
> cordova run android

From there on it takes about 6 minutes for the rest.

Start a new project with ionic start blank blank please and run the same commands there.

First guesses: Harddisk broken? Memory broken or full? Some anti virus thingie blocking files?

A post was split to a new topic: Build process creates two APKs - why?

@Sujan12: I started a new project as suggested. ionic cordova run android prod took about 5:15 mins in total, now. 3 minutes until the first reaction of the console…

Nothing happening for so long indicates to me that this could be a problem with something the CLI does in the background. Please open an issue at https://github.com/ionic-team/ionic-cli/issues and describe the problem there, maybe the CLI devs can give further ideas how to debug this.

Can you switch to another internet connection? Maybe hotspot from your mobile phone…
Try it on another machine in the same network?
On another network?

Thank you. I will do some tests.

For the record, I don’t agree with the suggestion to abandon LTS node/npm. If ionic doesn’t work properly with the latest LTS versions, I would argue that’s an ionic bug (and I haven’t seen any evidence of this, and I’m still using 6.11.1 as well).