Two projects in same time (Ionic 2 and Ionic 3)


#1

I have two projects, one on Ionic 2.2.3 and another with the last version of Ionic 3. But unfortunately I’m having to uninstall and install a version of Ionic whenever I change the project, because of the incompatibility of the new CLI version.

Is there a more efficient way to switch the IONIC 2 and IONIC 3 versions (including your CLI) without having to uninstall and install them?


#2

Hi there!

Soo there’s some confusion here. ionic 2.2.3 sounds like you’re talking about the CLI, not the framework, ionic-angular.

In this case, the Ionic-cli 3.x version is what you should be using for all your ionic projects. Regardless of what version of the framework you’re using (ionic-angular 2.x or ionic-angular 3.x), the 3.x version of the CLI will work.


#3

To add on what mike already said:

Run ionic info with your Ionic v3 CLI in both project directories to get the real framework, ionic-angular, version (and also loads of other useful output).


#4
Guibson@DESKTOP ~/Workspace/servicos (master)
$ ionic serve
? Looks like this is an Ionic Angular project, would you like to install @ionicy
? Looks like this is an Ionic Angular project, would you like to install @ionic
/cli-plugin-ionic-angular and continue? Yes
> npm install --save-dev --save-exact @ionic/cli-plugin-ionic-angular@latest
✔ Running command - done!
Starting app-scripts server: --port 8100 --livereload-port 35729 --address 0.0.0                                                      .0 - Ctrl+C to cancel
TypeError: AppScripts.serve is not a function
Guibson@DESKTOP ~/Workspace/servicos (master)
$ **ionic serve**
Starting app-scripts server: --port 8100 --livereload-port 35729 --address 0.0.0                                                      .0 - Ctrl+C to cancel
**TypeError: AppScripts.serve is not a function**

#5

When I try to run “ionic serve” I got this error:

TypeError: AppScripts.serve is not a function


#6

$ ionic info

global packages:

@ionic/cli-utils : 1.1.2
Ionic CLI        : 3.1.2

local packages:

@ionic/app-scripts              : 1.0.0
@ionic/cli-plugin-ionic-angular : 1.1.2
Ionic Framework                 : ionic-angular 2.0.1

System:

Node       : v7.10.0
OS         : Windows 10
Xcode      : not installed
ios-deploy : not installed
ios-sim    : not installed

#7

Your app-scripts version is pretty old. I’d update it to the latest, currently 1.3.7.


#8

Ok!! This resolved my problem … thanks :slight_smile:

npm install @ionic/app-scripts@latest --save-dev