Error: npm ERR! write after end
Try installing latest npm version this happens a lot with ionic.
npm install -g npm@latest
npm cache verify
npm i
If this doesn't work I advise you to switch to yarn. It's faster & easier to use. This is the link to download YARN.
After installing just run this command yarn global add cordova ionic
Ionic CLI uses npm by default. So go to your project & run $ yarn install
.
If you want Ionic to use yarn by default run this: $ ionic config set -g yarn true
In my case, I didn't downgrade my npm because it will cause chaos in other dependencies. Instead, I tried running
npm cache verify
Error gone...
Let, update the latest version of npm for running this command,
npm install npm@latest -g
Then run this command,
npm install -g cordova ionic