Managing Gem Version Conflicts in Discourse Plugins

AI-generated summary

A plugin developer, wings, is facing issues with gem version conflicts when rebuilding Discourse with their plugin after updating Discourse. The errors occur due to differences in gem versions between the plugin and Discourse Core. Currently, wings resolves the issue by updating the package to match the latest version in Discourse Core. However, they seek a more efficient solution that doesn’t require frequent updates.

merefield responded that updating dependent plugins to align with Discourse Core’s versions is necessary, and mixing versions isn’t possible. wings acknowledged this approach and considered implementing better versioning for their plugin to support users using older Discourse versions.

Hi, I am building a plugin for Discourse using external gems. I’ve already incorporated some suggestions from other posts regarding the use of external gems, such as Requiring external gems and Plugin using own gem - #3 by kgish. These suggestions involve adding additional packages needed for the external packages used. It works well for developing a plugin for Discourse. However, sometimes, after each Discourse update, I encounter errors related to conflicts in gem versions when rebuilding Discourse with the plugin and the latest version of Discourse.

here an example of an error

rake aborted!
Gem::LoadError: can't activate addressable-2.8.4, already activated addressable-2.8.5

I’ve observed a similar situation in other plugins, as seen in some cases in the following forum posts: Install discourse failed due to Custom Wizard plugin and Failed to Bootstrap after upgrade.

Currently, the solution I’ve been trying is to update the package to the latest version, aligning it with the version used in Discourse Core.

However, I’d like to inquire whether there is a solution to this issue that doesn’t require updating the package to match the latest version in Discourse Core each time I want to update.

You need to update (or PR) to each dependent plugin to align the versions, based on Core. You can’t mix versions.

In this case, if any plugin you use, uses addressable-x.x.x, you need to make sure it is brought up to date with addressable-2.8.5

Thanks for the reply, @merefield . Yeah, this is what I do every time I run into conflicts with the package versions. Perhaps I need to consider better versioning for the plugin so that users who still want to use an older version of Discourse can continue using the plugin.