For those who have been hiding in the hills for a while; you may not have noticed that the cool news for NativeScript is that we have a new version that has been coming for a while. 6.0 was officially released today!
Well 6.0 has been release; and there are a lot of things to like in 6.0, but if 6.0 doesn't work for your app; you might still need to run 5.4 to get your work done. Unfortunately, the NativeScript team did not listen to my advice and release a 5.5 to continue testing the new webpack only builds, so we now have a 6.0 with still a lot of webpack issues and now no easy work around because legacy mode was removed in 6.0.
One of the techniques, I used while testing 6.0RC on plugins and apps and reporting the massive number of issues I ran into; is making my install side-by-side. So now I have a
tns5 command which is my tns 5.4.2 install. And then
tns is my 6.0 release.
The first step to run a side-by-side install is to do a
npm i -g firstname.lastname@example.org to install 5.4.2 (the last 5.4 version) on your machine in the global node_modules. Now depending on the OS; this directory will be in a couple places:
The easiest way to find out where it is stored is to run the following command in your command or terminal shell: npm root -g
Under most linux installs this folder is here:
Under Mac OSX the folder can be in a couple places, depending on how you installed it.
For example because I run
nvm on my mac, my folder is located here:
And on windows 10, it is located typically here:
But using the
npm root -g will tell you exactly where it is on your machine.
So first navigate to this folder and find the "nativescript" folder; and then copy it in its entirety to the "nativescript5" folder. This gives you a fully working NS 5.4.2 version in a different folder that won't be overwritten when you do the
npm i -g nativescript@latest which will give you the NS 6.x version.
The final piece of this puzzle is creating the
tns5 command, on my mac the folder for where to put it is:
So I created the
tns5 symlink to point to
On Linux we needed to create the symlink in /usr/local/bin; and so I created the
tns5 symlink to ../lib/node_modules/nativescript5/bin/tns (the exact same relative path as mac)
npm i -g email@example.com
npm root -g
- cd (folder listed from npm root -g command)
- copy nativescript to nativescript5
npm i -g nativescript@latest
- create a
This should allow you to have a permanent install of v5.4.2 and then your normal update-able version .