Problem with Ionic Installation

Im trying to install ionic: sudo npm install g- cordova ionic
And I am getting : npm ERR! Unexpected end of JSON input while parsing near ‘…dova-serve":"^1.0.0",’
Please assist

sudo npm install -g cordova ionic or try without sudo

One solution: Uninstall your node, install nvm (or nvm-windows if you are on Windows), install a new node (which includes npm) with this, then install ionic and cordova again and try your command again. The problem should be gone.

I removed node and npm restarted my machine then installed node again like: nvm install node. I am running node v10.9.0 and npm v6.2.0
I then tried installing cordova and ionic: sudo npm install -g cordova ionic
Got the following: Unexpected end of JSON input while parsing near ‘…3.0.0",“shelljs”:"0.1’

did you removed Ionic,cordova,nodejs and npm
The problem will be nodejs

I have done all that but the problem wont go away, it keeps coming up with a different Unexpected end of JSON.

Yes I see is the problem with nodejs.Look which version of nodejs are using.
If you are using the newer version try to install an old version.
Which operation system are using?

I am using node 8.9.1 on macOS High Sierra v10.13.6 operating system.

Unistall nodejs and install 8.00 version.
I think are some problems abot unistalling nodejs so have look how to unistall completely nodejs.

try this:

brew uninstall --ignore-dependencies node
brew install node@8
brew link --overwrite --force node@8

Ive been trying all that and none has been working. Today I even used a mac that has not had any installations of node and did the whole thing from scratch and the problem still comes back to:
Unexpected end of JSON input while passing near .......

Thanx for trying to help. I found out the problem was on my network, it was not downloading some packages in full.

You are welcome!!!