How to update an app that uses an old version of MeteorJS?

Henrique A Schmaiske
Meteor Blog
Published in
3 min readSep 15, 2022

--

How to update your app that uses an old version of Meteor?

How do I 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?

Follow the Changelog page on Meteor documentation. It will help you better understand the changes from one version to another.

The command to update is straightforward:

meteor update —release METEOR@<version-number-goes-here>

I recommend that you update your application version by version. For example, if you are using version v1.8, you should update your project to 1.8.0.1, then 1.8.0.2, then 1.8.1, then 1.8.2, and so on. However, it is generally safe to directly upgrade patch versions, like from version 1.8 to 1.8.3

Don’t forget to check the possible breaking changes

Another 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.

Having a good test coverage in your application before updating is also a good idea, but sometimes this is not the case. So ensure 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, a dependency 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 need.

Good to read how Meteor packages work.

In a nutshell, to bring a package to your project and override its code:

  • You need to create a folder called packages in your project root.
  • Create a folder with the same name as the package 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 you need, like updating a dependency version 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/versions .

Node.js version updates

If Node.js was updated from one version to another, you should clean your node_modules folder and run meteor npm install to ensure it will download the correct packages for the newer node version. Don't forget to run your project and test suites to check if everything works properly.

Important updates

The most critical updates and the updates that will demand more work are related to 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 much pain.

You can also check the article "Reviving an ancient Meteor.js project in 10 minutes" by Jan Küster.

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.html

--

--