How to solve: Detected locally installed Ionic CLI, but it's too old--using global CLI?

I am getting this:

Detected locally installed Ionic CLI, but it’s too old–using global CLI.

How can I solve this? What should I do?

It means you have Ionic cli package locally installed in your project and it’s old.

package.json:

"ionic": "<some version>"

If you are not using it from there (99% chances you are not), just remove it:

npm rm ionic --save
4 Likes

What if I do use it? How can I update it?

To use local Ionic cli (the one you installed through npm in your current directory) you need to add some changes to your environment. In your ~/.bashrc (Linux) ~/.bash_profile (Mac) you need to add ./node_modules/.bin directory:

export NODE_LOCAL="./node_modules/.bin"
export PATH=${NODE_LOCAL}:$PATH
set +h # This is required to avoid path cache of commands

Restart the terminal and that’s all:

shamank@Paula:~$ which ionic
/home/shamank/.nvm/versions/node/v8.2.1/bin/ionic
shamank@Paula:~$ cd my-ionic-project
shamank@Paula:~/my-ionic-project$ which ionic
node_modules/.bin/ionic

If you do that, I recommend you to use also local “cordova” because old versions are not compatible with latest Cordova (>7): npm i cordova@6.5.0 --save (or some version you need to work with your local old ionic cli).

1 Like

Thank you, appreciated!

Works like a charm. Thanks :smiley: