Install the Ionic CLI with npm:
npm install -g @ionic/cli
If there was a previous installation of the Ionic CLI, it will need to be uninstalled due to a change in package name.
npm uninstall -g ionic
npm install -g @ionic/cli
npm install
npm run serve
npm run build