Multiple version of NativeScript



I can have multiple version of Node using NVM or such tools but how I can have multiple version of nativescript on my machine because it’s required to be installed globally.


good question… the only approach that I found was installing Parallels and installing a OSX in a VM, so there I can have 3.4 and in my host machine have 2.4


That’s sad :(. JS community should develop a feature of gemset which rvm has.


why would you need old version of nativescript cli when its already backward compatible ?


old version is need because, the production app was built in that version, upgrade that version will be catastrophic, because of the plugins, the braking changes, etc.


Have you tried having a local dev dependency for the CLI in your project? Angular CLI allows you to have both a global dependency and project-level dependencies. I personally haven’t tried this approach, but I don’t see why it wouldn’t work.


Hi, @sean-perkins is there any tutorial ??


This is how you can install and use a local dev dependency specific to your project:

inside your project

npm i nativescript@version --save-dev

Then instead of invoking tns command, you use the local dependency to run nativescript cli commands

./node_modules/.bin/tns run android, you will run other commands similarly, and all commands will go through that particular version of nativescript.


Thanks! the --save-dev flag affect the final production package?


It does not, developer (-dev) dependencies are not included in your final package, in much the very same way the TypeScript package doesn’t end up in the application, since it transpiles locally in order to produce javascript files which are in turn used in your application package.