Ionic cli v3 and v4 global in parallel on a mac?


#1

Do anyone knows if it’s possible to install two Ionic cli, the 3 and 4, in parallel on a mac?

If I did understand, installing the cli 4 (rc right now) is the way to begin to have fun with Ionic v4. On the other side, I would like to stick to cli 3 for daily business and current development of my productive app

Any thoughts?

I mean both

 npm i -g ionic
 npm i -g ionic@rc

#2

I just had to install the 2nd cli not globally :wink:

For those interested to install the cli 4

 mkdir /pathtomyalternatecli/
 cd /pathtomyalternatecli/
 npm install ionic@rc

then also if you want to test Ionic v4 angular without setting the global environment variable features.project-angular you could just edit start.js and remove a check

 cd node_modules/ionic/dist/commands/
 vim start.js

then search STARTER_TEMPLATES and edit the return value in order to not filter according the global variable respectively

 return STARTER_TEMPLATES;

and now you good to go to create a Ionic v4 angular project using your 2nd cli

cd /somewhereelse/
/pathtomyalternatecli/node_modules/ionic/bin/ionic start 

once finish, jump in the created folder and if you want to run it, don’t forget to reference the alternate cli

cd /somewhereelse/myionicv4testproject/
/pathtomyalternatecli/node_modules/ionic/bin/ionic serve

#3

I think a much easier way to deal with this is to install nvm and do the switching that way.


#4

actually not that easier, just have to specify the full path in cmd isn’t that a huge work :wink: