Ionic 4 is driving me nuts

I have installed Ionic 4, but my current project is made with @3.9.2 and every time I start the project I get this:

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

I also get really weird random errors, when changing project code and testing. I have to shut down command prompt and start it up again to get it working again. For instance, app-script error comes very often. Says that it’s not installed or something. And then I have start the command prompt again and the error goes away for a while.

I tried to run command to change version: npm i --save -E ionic@3.9.2, but it doesn’t work. When I run ionic info, it allways says using ionic version 4.0.5… Why doesn’t it change to use the local project version?

I don’t what to downgrade the global ionic to 3.9.2, because my computer setup is clean and fresh and I also what to make some “training projects” with Ionic 4.

What can I do to resolve this? Google doesn’t seem to have an idea how to fix this…

nvm should be capable of walling off completely separate installations for you.

That’s really not a solution. Try again.

Actually, I think I won’t.

plonk

1 Like

After you get some sleep and think about it, you’ll realize it is exactly the solution.

Additionally, I think there is some confusion between the ionic CLI and ionic framework.

The npm package ionic is the ionic CLI. Its current version can handle ionic projects with v3 and v4. So you can install the latest version globally npm i -g ionic@latest.

Ionic framework version 3 is called ionic-angular on npm. The latest version is 3.9.2.

Ionic framework version 4 is @ionic/angular and @ionic/core on npm. It’s currently @4.0.0-beta.2

Ionic CLI is not Ionic Framework.

This actually just means that in this specific project you have ionic installed locally. But the version is to old compared to the global ionic you are using. Uninstall the local package by running npm uninstall ionic --save in the project.

Everything else you wrote doesn’t really make sense to me.

Well, this is my ionic info:

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

Ionic:

ionic (Ionic CLI) : 4.0.5 (C:\Users\xxxx\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : ionic-angular 3.9.2
@ionic/app-scripts : 3.1.9

Cordova:

cordova (Cordova CLI) : 8.0.0
Cordova Platforms : android 7.0.0

System:

Android SDK Tools : 25.2.5
NodeJS : v8.11.3 (C:\Program Files\nodejs\node.exe)
npm : 5.6.0
OS : Windows 10

Environment:

ANDROID_HOME : C:\Users\xxxx.android

So, if I have CLI 4.0.5 installed, why am I getting all sorts of weird random errors, if It is suppose to work with earlier versions??? It was working just fine before upgrading to Ionic 4.

What kind of “random errors”?

I already posted above what you can do about the “Detected locally installed …” warning.

In general make sure you are using recent versions of everything:

Your Cordova tooling seems to be out of date, which might be causing all kinds of problems.
You can read about how to figure out the current Cordova versions and how to update CLI, platforms and plugins here: How to update Cordova CLI, Platforms and Plugins · ionic.zone

There is a newer version available:

Yes, but the point I’m trying to make is why global Ionic CLI (4.0.5) is FORCEFULLY driving over the (projects) locally installed CLI? Local CLI @3.9.2 is NOT old… I should be allowed to use it if I want.

Are you talking about Ionic CLI 3.9.2 or Ionic Framework 3.9.2?
(Because 3.9.2 is a pretty random version of Ionic CLI that is a year old - but is the most recent version of Ionic Framework)

just install the last cli everywhere, globally and in your Ionic v3 project

npm install -g ionic@latest
npm install ionic@latest --save-dev