[openstreetmap/openstreetmap-website] bundle exec rake yarn:install - Error (#3013)

Andy Allan notifications at github.com
Wed Jan 20 18:23:01 UTC 2021


I've investigated this today, and figured out what's going on. We have Thor 1.0.1 in our Gemfile.lock, and there's also the `ruby-thor` Ubuntu package that is version 0.19.4. Importantly, the `bundler` ubuntu package depends on the `ruby-thor` package, so if you use the packaged version of bundler and you run `bundle exec (something) you get the error. Bundler ends up loading both versions of thor - first from the package in order for bundler itself to work, then the gem version as part of loading all the gems in our Gemfile

The question then is why do we have the ubuntu packaged version of bundler installed? We have a specific line in the INSTALL instructions to install bundler using rubygems. Note that this approach - using gem instead of apt - was added 7 years ago for unrelated reasons. But more recently, [the instructions were updated](https://github.com/openstreetmap/openstreetmap-website/commit/9299f8ca23d7cd7a1cb2f080bf6bd440140d3637) to also install the `bundler` package. At the time this wouldn't have caused any problems, but after https://github.com/openstreetmap/openstreetmap-website/commit/aa7256d617748e94d1b6295debc58a14819f0eae there is a lurking problem with the Thor major version mismatch.

My suggestion would be to remove the ubuntu package `bundler` from the installation list, and revert to installing bundler only via the `gem install` approach. But I don't know why the package was added - @tomhughes can you remember?

But I'm aware that if a developer already has the Ubuntu `bundler` package installed for some other reason, things might go awry. Less likely on a fresh VM image, but more likely if they are developing normally. I'm not sure whether there's an approach that can fix it here. Constraining our Gemfile (as per the workaround described above) is only a temporary fix, because as soon as the `ruby-thor` package is updated to v1+ we will land right back here again. 

Personally I have avoided this on my own laptop by not having installed the packaged version of bundler.

Finally, this might be the root cause of the other complaints about 'yarn:install' recently, since it is the first thing in the INSTALL notes that uses `bundle exec`.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/issues/3013#issuecomment-763841430
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20210120/c404a6e2/attachment-0001.htm>


More information about the rails-dev mailing list