简体   繁体   中英

npm/Frameworks/ How to know which Version should I use?

I'm facing the problem that I never know which Version of npm, Ionic and so on, I should have installed .

In example:

  • "Oh a new Ionic CLI Version is here. Lets install it"
  • Installs CLI v3.9.0
  • "Oh nothing works in my project anymore. Mhhh lets update the Framework too"
  • Installs ionic-angular 3.6.0
  • "Oh to get the CLI working I need an npm version above 5"
  • Installs new npm Version

And after all that updates nothing works anymore , because this version of bla bla bla doesnt work with the version of that bla bla bla. We all know the struggle.

But however there are in all forums out there always a hand of people which seem to know exactly which version you have to install from whatever-framework to get your project to work.

There are also many programming tutorials out there. But first of all we need to learn the structure and how all frameworks and clients and so on are related and cooperating.

I and certainly others, would like to know how to know in example that I should not install the new update because it is not compatible with other frameworks. But without this knowledge we beginners have, we will install updates again and again immediately without knowing if it would be better to wait or not.

Here is another example:

You install npm 5+ without knowing that Ionic 3.6 need npm below 5 to work perfect. Now you want to install a Plugin for your Project and get an GYP Error in example. Well without knowing that your npm version is only causing the Error a beginner would waste so many time for searching how to reslove that GYP Error. Logic. Because how should he know that he has to wait for a newer Version of Ionic before he installs npm 5+

So please help me and many many others and explain and lern us where and how we get this information we need to know, so in the end we beginners are also the gurus which know exactly how to do "versioning".

One way to find a working configuration is to look if the project is using some form of continuous integration. In that case there should be a build and test environment defined.

Looking at ionic and ionic-cli repositories, they seem to use a current node 7 and node 6.1.0:

https://github.com/ionic-team/ionic/blob/master/circle.yml

https://github.com/ionic-team/ionic-cli/blob/master/circle.yml

First of all you may want to have a look at semantic versioning . For me it's one of the most important concept in development. It means that versioning must be done in a way that allows other to predict what will happen when upgrading. Versioning should be done like that:

major . minor . patch

  • patch : bug fixes (do not change library/framework behavior)
  • minor : new features, backward compatible (do not change library/framework behavior)
  • major : new features, not backward compatible (make break your current app using this library)

So, you know if the new library version will be compatible with your current implementation of it.

Then, you must also always look at the changelog before updating a library, especially a big one like Ionic. You can find Ionic's one here for example. It will usually inform you of breaking changes (if major version), incompatibilities and steps to follow in order to migrate. Also, Ionic (and probably other libraries) often provide the list of package.json dependencies like here . From my experience, this list is important as more recent versions of dependencies may not be compatible with the new library version. When this is not provided, starters applications can also be useful. They are frequently updated alongside the "parent" library/framework and their dependencies usually up to date. See for example this Ionic App Base package.json .

Ionic uses GitHub but depending on the framework or library you may find this changelog directly on their website or somewhere else.

Finally, you may still have incompatibilities. Then your only option is to debug. When you find the crashing library you can look at the opened issues / forums and see if there is any known incompatibility.

To sum up I would say that updating always requires some work, at least investigating before the update if it may cause any problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM