Hi all, I encountered this and solved it another way…
Installed Virtualbox and then Ubuntu in it, and then the required nodejs, npm, Ionic, Cordova, java, Android SDK, etc.
And then run the command, no more out of the blue errors as with Windows. Able to build my APK when required now.