NativeScript: 2.5 and 3.0 upgrade learning moments

Well, my son has been learning Web and NativeScript for a while and was continuing to work on NativeScript project today (Lots of cool things like GridLayouts, ListViews, Sliders).

So he finally got to see first hand the wonderful world of fun that the new NativeScript 3.0 upgrade has caused.

One of his requirements for his application was ability to include a picture with each data item.  So he used my http://nativescript.rocks site to find the plugins and then did a simple tns plugin add nativescript-imagepicker -- then a tns run android and got the error cannot require the nativescript-imagepicker file in the Android crash dialog.   So I had him do a full rebuild, then as it still doesn't work (and of course he is telling me the plugin shows in the node_modules folder on his local machine).   So, next I have him open his packages.json file.   Its not present.... Hmm, so I ask him try to do a tns plugin add nativescript-imagepicker again.  This time he saw the error about the current project does not supported 3.00 runtimes.

I'm like welcome to the wonderful world of 3.0 incompatibilities, high five time!    You have reached the pinnacle of achievement; welcome to my world!   😉

So then I explained why he was now seeing this issue; and that 3.0 is not compatible with 2.5 in several ways and all the ins and outs of why and then I said you have two choices...

  1. Upgrade to 3.0, and upgrade your plugins to 3.0 -- No guarantee all of them are 3.0 compatible, so he would need to look into that.  Even some of my plugins I haven't had time to test on 3.0 and some aren't 3.0 compatible yet.     This is something that should have been handled better by Progress, do to the number of breaking changes and sometimes missing documentation.   But as the community has time, and large number of the issues are fixed by Progess; 3.x will eventually turn into a good solid release, and this will all be a bad memory...
  2. Stay with 2.5 and grab a older version of the plugin.

He decided to go the safer and easier route so I showed him how to use the npm info naitvescript-imagepicker command to find the older version of the plugin.  In most cases the last version before 3.0 is the version you want...   In this case 2.5.2 was the last version before 3.0.

npm r nativescript-imagepicker to make sure to delete the 3.0 version that is in his node-modules folder.  Then we used tns plugin add nativescript-imagepicker@2.5.2 and we do a tns platform remove then tns platform <strong>a</strong>dd again to make sure nothing was left over from the prior failed attempts.

Of course, it wasn't as simple as that -- the developers of the imagepicker plugin has a really stupid issue that were causing building issues that I had to fix for him.  But that is a story for another day...  😉

But none the less it turned into a great teaching moment to improve his skill set on both CLI, NPM and NativeScript...  And so off he goes...  So proud, of this guy...  Can't wait to show off some of his stuff...

 

1 comment

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.