[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

6 Likes

Hi @rjdavid,
This is the part of meteor that I find very cumbersome - I have spent the past 2 days upgrading meteor and am now stuck at version 2.2.4 - when I try to go to v2.3.1, I get the errors you mentioned - unable to upgrade - have tried adding api.use(‘accounts-base@1.0.1 || 2.0.0’) but now get error:
package.js:56:7: Package names can only contain lowercase ASCII
alphanumerics, dash, dot, or colon, not “|”.
package.js:58:7: Package names can only contain lowercase ASCII
alphanumerics, dash, dot, or colon, not “|”.
Let me know if you have any suggestions for upgrading to 2.3+
Thanks
Frank

1 Like

@spraakit I am not familiar with the error. Better you post another topic about this error or post it as an issue in github