Similar to this question, when I run above commands I got:
[ERROR] Unable to find command: cap build android (or ios)
I considered all the given answers and points for that question, e.g., I ensured:
None of the above solved the problem. Does any one have any idea how to get it working? Thanks in advance.
Well, the solution was quite easy. As for this question @jcesarmobile mentioned, the cli was very old version. You first need to uninstall it via:
npm uninstall -g ionic
npm uninstall -g @ionic/cli
Then as mentioned here, in macOS, you have to remove the ionic directory (run ionic info
to see where it is located).
Then reinstall ionic via:
npm install -g @ionic/cli