Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bundle exec rake yarn:install - Error #3013

Closed
basilstr opened this issue Dec 20, 2020 · 13 comments · Fixed by #3065
Closed

bundle exec rake yarn:install - Error #3013

basilstr opened this issue Dec 20, 2020 · 13 comments · Fixed by #3065
Labels
support A user needs help setting up their development environment

Comments

@basilstr
Copy link

I try install openstreetmap-website.
In the following command:
bundle exec rake yarn:install

screen
Screenshot_1

I used recommendation tomhughes
sudo apt-get install npm
sudo npm install -g yarn
But the result remained the same

My system is hosted on VirtualBox Version 6.1.16 r140961 (Qt5.6.2) (windows)
Screenshot_2

Description: Ubuntu 20.04.1 LTS
Release: 20.04

What am I doing wrong?

@tomhughes tomhughes added the support A user needs help setting up their development environment label Dec 20, 2020
@RogierB
Copy link

RogierB commented Dec 21, 2020

I've got the same problem.
I'm running Ubuntu 20.04 on Windows 10 in WSL.

@mmd-osm
Copy link
Contributor

mmd-osm commented Dec 21, 2020

Error message looks very similar to: https://bugs.launchpad.net/ubuntu/+source/ruby-thor/+bug/1885424

@RogierB
Copy link

RogierB commented Dec 21, 2020

I can confirm that adding the 'gem 'thor', '~> 0.20.3'' to the GemFile does fix the problem.
My knowledge with ruby, bundle, yarn and the likes is limited but i do understand that this is a way older version than what OSM is supposed to be using. I also got a message that i went back to an older version when running this "fix"

@tuckerrc
Copy link
Collaborator

tuckerrc commented Dec 21, 2020

It looks like you are using the system ruby and gems. Is there any reason you didn't use rbenv? I'm not very familiar with WSL but I assume you can install rbenv and ruby the same way you would on a regular Ubuntu install.

Ignore this

@gravitystorm
Copy link
Collaborator

Is there any reason you didn't use rbenv? I'm not very familiar with WSL but I assume you can install rbenv and ruby the same way you would on a regular Ubuntu install.

  • We don't recommend rbenv. Contributors are free to use it if they want, but we don't offer any support or encouragement to do so.
  • They are using Virtualbox, not WSL

@tuckerrc
Copy link
Collaborator

Sorry, I saw the "optional" instructions for rbenv in the INSTALL.md and that is what I used. I won't recommend it again.

I mixed up the issue opener with a commenter about WSL. (I guess I'm still a little new)

@gravitystorm
Copy link
Collaborator

Sorry, I saw the "optional" instructions for rbenv in the INSTALL.md and that is what I used. I won't recommend it again.

I mixed up the issue opener with a commenter about WSL. (I guess I'm still a little new)

No worries!

@basilstr
Copy link
Author

Many thanks to RogierB.
I add to GemFile
gem "thor", "~> 0.20.3"
Then I executed
bundle update thor
and this problem has been solved

@gravitystorm
Copy link
Collaborator

gravitystorm commented Jan 20, 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 to also install the bundler package. At the time this wouldn't have caused any problems, but after aa7256d 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.

@tomhughes
Copy link
Member

So #2299 (comment) seems to be the origin of that install command being added.

@gravitystorm
Copy link
Collaborator

Bundler ends up loading both versions of thor

For what it's worth, I've also investigated the problems with the ruby-bundler package, to see why it breaks and other options (like installing bundler via gems, or on Fedora etc) work fine. The problem originates in the upstream Debian package, but I've no idea if/when it will be fixed since it touches on the concept of vendoring which is a sore point in many parts of that world. I've updated both the Debian and Ubuntu bug trackers with the root cause, but I don't think we should hold our breath.

@gravitystorm
Copy link
Collaborator

So #2299 (comment) seems to be the origin of that install command being added.

I didn't notice that at the time, but it looks like that OP missed the instruction to install bundler via the gem install route. Using the package would normally be entirely reasonable, and wouldn't have caused any problems back then anyway, since whatever caused our original gem install instruction was ancient history by that point, and the thor-vendoring problem wasn't revealed yet either.

@tomhughes
Copy link
Member

The interesting thing is that they haven't unbundled eveything - the ruby-bundler package does still have some vendored gems.

I just checked and the Fedora package doesn't unbundle thor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support A user needs help setting up their development environment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants