pantry icon indicating copy to clipboard operation
pantry copied to clipboard

RubyGems install errors

Open sporkd opened this issue 1 year ago • 5 comments

If you happen to have an existing bundler at /usr/local/bin/bundle, then pkgx rubygems install fails with:

Screenshot 2024-10-01 at 8 55 50 AM

This seems very wrong because pkgx doesn't even install anything to /usr/local. So having an old bundle binary lying around shouldn't cause rubygems install to fail.

But come to think of it, I've experienced a lot of weird things using pkgx rubies that cause subtle bundle install issues, and I suspect this faulty gem home might be the root of it. Inside a pkgx project when I run gem env it has /usr/local in my gem path:

Screenshot 2024-10-01 at 10 12 11 AM

And it carries through to your bundle env as well:

Screenshot 2024-10-01 at 10 13 15 AM

The value for Gem Home above should be whatever pkgx ruby -e 'puts Gem.user_dir' evaluates to.

Not sure what's happening, but I suspect pkgx rubygems needs to be more tightly coupled to pkgx ruby.

sporkd avatar Oct 01 '24 16:10 sporkd

there's a lot of path manipulation being done in the recipes for ruby-lang.org and rubygems.org to try and keep them both isolated and working. if you're a dab hand at ruby, perhaps you can figure out what piece is missing to make it all tick.

jhheider avatar Oct 01 '24 17:10 jhheider

Can take a look at it @jhheider. I imagine it's something to do with this comment. Do you know the reason this was needed?

sporkd avatar Oct 01 '24 21:10 sporkd

I don't offhand. It's likely darwin-focused, since that's our primary development platform. You could try just adding an if: darwin to that stanza and see if it helps you.

jhheider avatar Oct 01 '24 21:10 jhheider

Well @jhheider. I'm on darwin as well, and that's where the install error I posted above is happening. It can be replicated on darwin with:

sudo touch /usr/local/bin/bundle
pkgx install rubygems.org@latest

However, it does only appear to be an issue with pkgx install name@version, not pkgx name@version in case that helps.

One other question. Why the discrepancy between these two ways of calling pkgx without install?

Screenshot 2024-10-01 at 4 14 11 PM

sporkd avatar Oct 01 '24 22:10 sporkd

Ah, yeah. The install scripts are a little more fragile. That's possibly something we should move to pkgxdev/pkgx for exploration.

For invocation, gem@latest is a provides:. The latter would need to be pkgx +rubygems.org@latest gem --version. Packages don't have default binaries.

jhheider avatar Oct 01 '24 22:10 jhheider