DEV Community

Cover image for How to update your app that uses an old version of MeteorJS?
Meteor Software
Meteor Software

Posted on

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

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 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@<version-number-goes-here> 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 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.

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

In 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/versions.

Node.js version updates

Node.js 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 updates

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

Top comments (0)