Ionic 1 && 2 work with different Node Versions?

I was having some major build issues with Ionic 1.7.14 on NodeJS v6. Here you can see the problem and some of the solution that people offered me.

ionic.project has been renamed to ionic.config.json, please rename it.

For the past 6 months I have been working and two Ionic 1 Apps. earlier last month I began to work with Ionic 2. So I installed it via npm… It all seem well I was working on Ionic 2 apps but did not quite connect the dots as to why all of the sudden I could not build anything on my past Ionic 1 apps.

FIRST SOLUTION:

I re-install Ionic 1.7.14 and I downgraded from Node 6.0 to Node 4.4.4 - voila! It was working once again! Ionic 1 was building and the CLI understood all my commands… No more errors.

THE CONSEQUENCES:

I had to always make sure I was using Node 4.4.4 whenever I wanted to work on Ionic 1.7.x apps… I use NVM so a simple nvm use 4.4.4 would do the trick.
But when I tried to work on Ionic 2 apps I realized that Ionic 2 was no longer installed and there for had to be re-installed, again. So I did…

RE-OCCURING ISSUE:

After re-installing Ionic 2, working a bit on that app then moving on to continue working on my other Ionic 1 app I realized that when I tried to run ionic serve the CLI gave me some errors which led me to believe I did not have ionic 1 installed… WTH!? Here we go again… re-install Ionic 1 version 1.7.x

Later I tried to ionic serve an Ionic 2 app and gulp was not running the build… It serve the app to the browser but none of my code was being built and implemented into the app. I then realized that the CLI was not running my commands as Ionic 2 but Ionic 1… What now? You guessed it. I had to re-install Ionic 2

THE CONNECTION between Ionic and Node versions

So yes, It took me a while to make the connection and I still don’t quite understand why this is happening but I’ve found out that I do not need to repeatedly install Ionic versions as I wish to use them… I just have to switch between Node Versions instead.

Ionic 2 --> works with Node 6.x
Ionic 1 --> works with Node 4.4.4

As long as I am using the respective Node Version with each I have no issues. BUT is this practical? Is there something wrong with my installs and file paths? I am curious if anyone has the same issue.

Last I heard, there was so much breakage in node 6 that Ionic folks were recommending sticking to 5.x, period.

We recommend using Node 5 and npm 3 for both 1 and 2

2 Likes

Thank you so much! :slight_smile:

This conflicts with your documentation here Ionic App CLI Development where is states “The CLI requires Node 4.X (Node 5.X has been known to cause a number of issues).

Am I to assume that since your post/answer was made in May of this year, and that the page I linked above is official and the most recent info, that using Node 5.X is NOT the recommended version?

The reason I ask is I am having various issues with ionic. I would really appreciate the latest and greatest recommendation for using ionic 2.X, as far as which Cordova, node and npm version to use.

Thanks.

1 Like