[How to fix] Package constraints error when upgrading to Meteor 2.3+

When you upgrade to Meteor 2.3+, there is a possibility that you will receive a package constraint error like this:

Errors while initializing project:

While selecting package versions:
error: Conflict: Constraint accounts-base@1.0.1 is not satisfied by accounts-base 2.0.0.
Constraints on package "accounts-base":
* accounts-base@2.0.0 <- top level
* accounts-base@~2.0.0 <- top level
* accounts-base@2.0.0 <- service-configuration 1.1.0 <- accounts-base 2.0.0
* accounts-base@2.0.0 <- accounts-password 2.0.0
* accounts-base@1.7.1 || 2.0.0 <- matb33:collection-hooks 1.1.0
* accounts-base@1.0.1 <- cultofcoders:persistent-session 0.4.5
* accounts-base@1.7.1 || 2.0.0 <- apollo 4.1.0

Cause of the error

Accounts package has undergone some major changes including a major version bump

Solution #1
Ask the package author to upgrade his package as indicated in the migration steps in the changelog

If you are maintaining a package that depends on one of the accounts packages which had a major version bump you will either need to set the new version manually or set api.versionsFrom(โ€˜2.3โ€™). You can also have it reference its current version and 2.3 like this: api.versionsFrom([โ€˜1.12โ€™, โ€˜2.3โ€™]), for specific package it can be like this: api.use(โ€˜accounts-base@1.0.1 || 2.0.0โ€™).

Solution #2
If the author of the package is no longer active, the general solution is to fork the package to your packages folder and update the version constraints yourself as quoted in solution #1 above.

How to fork an atmosphere package?: Writing Atmosphere Packages | Meteor Guide

5 Likes