Ionic serve fails after upgrade to CLI 5.0.2 - [ng] The system cannot find the path specified

I upgraded the ionic CLI to 5.0.2 (from 4.12.something, if I remember correctly) with

npm install -g ionic

after that, ionic serve no longer works:

C:\mobile\myappdir>ionic serve
> ng.bat run app:serve --host=localhost --port=8100
[ng] The system cannot find the path specified.

[ERROR] ng has unexpectedly closed (exit code 1).

        The Ionic CLI will exit. Please check any output above for error details.

I tried running the following, but it didn’t change anything:

npm install -g cordova-res native-run
npm install @ionic/angular-toolkit@latest

Other pertinent info:

C:\mobile\myappdir>ionic info


Ionic CLI : 5.0.2 (C:\Users\alfon1\AppData\Roaming\nvm\v10.15.0\node_modules\ionic)
Ionic Framework : @ionic/angular 4.4.0
@angular-devkit/build-angular : 0.13.9
@angular-devkit/schematics : 7.3.9
@angular/cli : 7.3.9
@ionic/angular-toolkit : 1.5.1


Cordova CLI : 8.1.2 (cordova-lib@8.1.1)
Cordova Platforms : android 7.1.4
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 2.4.1, (and 8 other plugins)


cordova-res : 0.3.0
native-run : 0.2.5


Android SDK Tools : 26.0.2 (c:\users\alfon1\appdata\local\android\sdk)
NodeJS : v10.15.0 (C:\Program Files\nodejs\node.exe)
npm : 6.4.1
OS : Windows 10

Everything was running correctly until the CLI upgrade.

Other ionic commands also fail with a similar message (e.g. ionic build).

“Cordova build android” runs without an issue and produces an APK.

“ionic cordova build android” fails:

C:\mobile\davdtexv03>ionic cordova build android
> ng.bat run app:ionic-cordova-build --platform=android
The system cannot find the path specified.
[ERROR] An error occurred while running subprocess ng.

        ng.bat run app:ionic-cordova-build --platform=android exited with exit code 1.

        Re-running this command with the --verbose flag may provide more information.


I spent a couple hours tryng to solve the same problem as you.
And, unfortunately, the only solution I found is

npm i -g ionic@4.12.0

I’ll just wait for other to help us, but until that, with the old CLI I can keep working…

Dear Bruno,

Thanks for your message.

After spending some more time without any tangible results, I had to do the same.

For the record, some of the things I tried before reverting to 4.12.0:

npm install -g cordova-res native-run
npm install @ionic/angular-toolkit@latest
npm update -g cordova
cordova platform update

All this didn’t help. Then I reverted to the old version of ionic-cli (npm i -g ionic@4.12.0) and everything was fine. Just to be sure, I moved to the new version again (npm i -g ionic) and again ionic serve did not work. I then tried npm install to check for missing dependencies and npm audit to check for other issues. Both commands found no issues. At last I reverted to 4.12.0 once again.

On the plus side, I have found that I can move between the two versions with reproducible results, so if someone here asks me to check something or offers a fix (or at least a workaround), I can do it.

1 Like

I tried installing ionic CLI 5.1.0, but it has the same problems as 5.0.2, so I went back to 4.12.0 which works.

Can you try remove and add platform again?