Sudo npm install ionic fails ERR! unexpected eof


#1

I’m on a mac, osx 10.10.4

my ionic was working, until I ran npm update ionic which broke my ionic.
I then uninstalled node and npm.
I reinstalled node and npm using nvm.
And I’m now trying to install ionic.

cordova installs successfully, cordova version: 5.1.1

but the ionic installation fails…
sudo npm install ionic --verbose

npm ERR! tar.unpack untar error /tmp/npm-5830-cb9b7451/registry.npmjs.org/npm/-/npm-2.1.3.tgz
 ...
npm ERR! Darwin 14.4.0
npm ERR! argv "/Users/lu/.nvm/versions/node/v0.12.7/bin/node" "/Users/lu/.nvm/versions/node/v0.12.7/bin/npm" "install" "-g" "ionic" "--verbose"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3

npm ERR! unexpected eof
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>
npm verb exit [ 1, true ]
npm verb unbuild lib/node_modules/ionic
npm info preuninstall ionic@1.6.1
npm info uninstall ionic@1.6.1
npm verb unbuild rmStuff ionic@1.6.1 from /Users/lu/.nvm/versions/node/v0.12.7/lib/node_modules
npm verb gentlyRm vacuuming from /Users/lu/.nvm/versions/node/v0.12.7/bin/ionic up to /Users/lu/.nvm/versions/node/v0.12.7
npm info postuninstall ionic@1.6.1
npm verb gentlyRm don't care about contents; nuking /Users/lu/.nvm/versions/node/v0.12.7/lib/node_modules/ionic

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/lu/npm-debug.log

did anyone else encounter this error? any hints would be appreciated.
I’ve tried npm cache clean, but no luck.


#2

Some members reported issues with node 0.12.5 and you use 0.12.7.
0.12.4 works fine for sure.

I see you use nvm so installing another version of node is trivial.

I’m just surpirsed that you have to use sudo


#3

tried with 0.12.4, no luck.


#4

Have you tried a manual cleanup ionic from your global and local node_modules?


#5

yes, I did try sudo rm -r /Users/lu/.nvm/versions/node/v0.12.4/lib/node_modules/ionic

EDIT:
I realized, there is also this line on my error log:

npm ERR! tar.unpack untar error /tmp/npm-5830-cb9b7451/registry.npmjs.org/npm/-/npm-2.1.3.tgz

#6

Kept getting the error when trying to install Ionic-cli 1.6.1.
Tried to install an older version: 1.3.4, and it was successful.
I’ll stick with the older version for now… at least it works.


#7

Have you posted an issue on github?