Unable to update to 3.20.0

I keep getting this prompt to update:

The Ionic CLI has an update available (3.19.1 => 3.20.0)! Would you like to install it?

I’ve googled, tried saying yes to that prompt, updating with “–update-binary” to reinstall and “–build-from-source” to recompile, tried uninstalling cordova and ionic and reinstalling with sudo npm install -g cordova ionic@latest. After all of that, my ionic info is still:

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.1
ionic (Ionic CLI) : 3.19.1

global packages:

cordova (Cordova CLI) : 8.0.0 

local packages:

@ionic/app-scripts : 3.1.8
Cordova Platforms  : android 7.0.0 ios 4.5.4
Ionic Framework    : ionic-angular 3.9.2

System:

Node  : v8.9.4
npm   : 5.8.0 
OS    : macOS High Sierra
Xcode : Xcode 9.3 Build version 9E145 

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : pro

Any way to fix this? Thanks!

your global cli isn’t updated yet =>

npm install -g ionic

After I run

sudo npm install -g ionic

I get this: “+ ionic@3.20.0
updated 1 package in 18.203s”

then “ionic info” still returns this:

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.19.1
ionic (Ionic CLI) : 3.19.1

This is why you never use sudo if you can avoid it. You might have admin-approved a corrupt install at some point, and now here you are. I suggest you uninstall Ionic, clean the npm cache, then reinstall Ionic. This may not work, but it’s a first step. if it doesn’t work, you might have to nuke your node-modules folder, clean the npm cache, and then run npm i.

when I don’t use sudo, I get errors:

npm WARN checkPermissions Missing write access to /Users/usr/.npm-global/lib/node_modules/ionic
npm ERR! path /Users/usr/.npm-global/lib/node_modules/ionic
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access ‘/Users/usr/.npm-global/lib/node_modules/ionic’
npm ERR! { Error: EACCES: permission denied, access ‘/Users/usr/.npm-global/lib/node_modules/ionic’
npm ERR! stack: ‘Error: EACCES: permission denied, access ‘/Users/usr/.npm-global/lib/node_modules/ionic’’,
npm ERR! errno: -13,
npm ERR! code: ‘EACCES’,
npm ERR! syscall: ‘access’,
npm ERR! path: ‘/Users/usr/.npm-global/lib/node_modules/ionic’ }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/usr/.npm/_logs/2018-05-03T22_07_24_363Z-debug.log

You see you’ve got a mismatch in your global libs

When you install with sudo it tries to install the lib under

 /Users/usr/.npm-global/lib/node_modules/

when you run ionic it try to find the lib under

/usr/local/lib/node_modules

you’ve got some problem in your node/npm installation. maybe you use multiple node/npm or multiple config something like

and I’m agree with @AaronSterling using sudo (I did that too at first) is a bad practice

Ok, I uninstalled cordova ionic and node, reinstalled without using sudo:

npm install -g ionic cordova
/Users/usr/.npm-global/bin/cordova -> /Users/usr/.npm-global/lib/node_modules/cordova/bin/cordova
/Users/usr/.npm-global/bin/ionic -> /Users/usr/.npm-global/lib/node_modules/ionic/bin/ionic

  • cordova@8.0.0
  • ionic@3.20.0

and now I get

-bash: ionic: command not found

… also …

if installing with sudo is a bad idea, they should remove this from the website:

Ionic CLI and Cordova
With Node and NPM setup, let’s install the Ionic and Cordova CLI.

$ npm install -g ionic cordova

Note: The -g means this is a global install, so for Window’s you will need to open an Admin command prompt. For Mac/Linux, you’ll need to run the command with sudo.

… cordova was also not found …

I imagine thats what the ionic install doc means by “run the command with sudo”. So for now, so I can still work, I’ve added both of these to my .bash_profile. Anything I should expect to go wrong with that?

I’m currently up and running testing on both ios and android devices, and ionic is successfully updated to 3.20.0 after deleting everything and installing, though, so that’s good.

Try now to close all your bash console and open them again (to be sure your profile is load again)

Then try to reinstall the libs of your project, in your project root

rm -r node_modules
npm install

Hope it will help

All appears to work at this point. Got my test devices running again. Thank you both for your help!

1 Like