How to update your app that uses an old version of Meteor?How to check the Meteor version of my project?First, you must know which Meteor version you are running in your project. The easiest way is to run meteor --version inside your project folder.If you run this command outside of your project folder, it will show the Meteor version that is installed on your machine.Okay, I know the Meteor version. Now what?I recommend you to follow the Changelog page on Meteor documentation. It will help you understand better what changes from one version to another.The command to update is straightforward: meteor update —release METEOR@ and I really recommend that you update step by step, not skipping any versions. For instance: if you are using version v1.8, you should update your project to v1.8.0.1, then v1.8.0.2, then 1.8.1, then 1.8.2, and so on.Don’t forget to check the possible breaking changesAnother thing to remember is the breaking changes and the migration steps. Sometimes they are effortless, and you don’t need to change anything in your code, but sometimes it will take a while to update your code and move to the next version, so read carefully every release to avoid missing anything. That’s why it is essential not to skip any version when updating.It is also a good idea to have a good test coverage in your application before updating, but I know sometimes this is not the case. So make sure you run your app after every update, check if things are working correctly, or run your test suite.Got stuck on a Package. What to do?One thing that may be hard to understand is how to update your packages, sometimes, there is a dependency that is not updating, and you need to do that manually.If you cannot find a version that satisfies your Meteor version or if the Package is no longer maintained, you can always bring this package to your app and override anything you want and ping us on Github.You can check here how Packages workIn a nutshell, to bring a package to your project and override anything you want:
- You need to create a folder called packages in your project root
- Create a folder with the same name of the package that you want to override. E.g.: matb33:collection-hooks
- After that, copy the code from the package repository and paste it into your created folder.
- Now you can update any code that you need, like updating a dependency version that can be found in the package.js file.
The api.versionsFrom('x.x.x'); method can be really helpful to get the same package versions that are already in your project - this is located in ./meteor/versionsNode version updatesNode version, if it was updated, you should clean your node_modules folder and run meteor npm install to make sure it will download the correct packages for the newer node version. Don't forget to run your project and test suites to ensure everything works properly.Important updatesThe most critical updates and the updates that will demand more work are MongoDB. There are a few Breaking Changes in their API, especially in v2.3 and v2.6, but there are migration guides that will help you go through this without any pain.I hope you learned how to update your apps more quicker. You can always ask for help on Forums and Slack if you get stuck in some part.Good luck updating your Meteor app.Reference: https://docs.meteor.com/changelog.htmlHow to update your app that uses an old version of Meteor? was originally published in Meteor Blog on Medium, where people are continuing the conversation by highlighting and responding to this story.