Skip to content

Add missing dependency for environment_loader.rb and repository.rb#2997

Open
elaraspace wants to merge 1 commit into
ruby:masterfrom
elaraspace:master
Open

Add missing dependency for environment_loader.rb and repository.rb#2997
elaraspace wants to merge 1 commit into
ruby:masterfrom
elaraspace:master

Conversation

@elaraspace

Copy link
Copy Markdown

I tried to use Solargraph and that got me into an error that seemed to be caused by rbs:

$ solargraph 
/Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/gems/3.3.0/gems/rbs-4.0.2/lib/rbs/environment_loader.rb:26:in `<class:EnvironmentLoader>': undefined method `Pathname' for class RBS::EnvironmentLoader (NoMethodError)

    DEFAULT_CORE_ROOT = Pathname(_ = __dir__) + "../../core"
                        ^^^^^^^^
	from /Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/gems/3.3.0/gems/rbs-4.0.2/lib/rbs/environment_loader.rb:4:in `<module:RBS>'
	from /Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/gems/3.3.0/gems/rbs-4.0.2/lib/rbs/environment_loader.rb:3:in `<top (required)>'
	from <internal:/Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:139:in `require'
	from <internal:/Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:139:in `require'
	from /Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/gems/3.3.0/gems/rbs-4.0.2/lib/rbs.rb:40:in `<top (required)>'
	from <internal:/Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:139:in `require'
	from <internal:/Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:139:in `require'
	from /Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/gems/3.3.0/gems/sord-7.1.0/lib/sord/resolver.rb:3:in `<top (required)>'
	from <internal:/Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:139:in `require'
	from <internal:/Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:139:in `require'
	from /Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/gems/3.3.0/gems/sord-7.1.0/lib/sord/type_converter.rb:4:in `<top (required)>'
	from <internal:/Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:139:in `require'
	from <internal:/Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:139:in `require'
	from /Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/gems/3.3.0/gems/sord-7.1.0/lib/sord/generator.rb:3:in `<top (required)>'
	from <internal:/Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:139:in `require'
	from <internal:/Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:139:in `require'
	from /Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/gems/3.3.0/gems/sord-7.1.0/lib/sord.rb:3:in `<top (required)>'
	from <internal:/Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:139:in `require'
	from <internal:/Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:139:in `require'
	from /Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/gems/3.3.0/gems/solargraph-0.60.0/lib/solargraph/shell.rb:7:in `<top (required)>'
	from <internal:/Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:139:in `require'
	from <internal:/Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/site_ruby/3.3.0/rubygems/core_ext/kernel_require.rb>:139:in `require'
	from /Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/gems/3.3.0/gems/solargraph-0.60.0/bin/solargraph:9:in `<top (required)>'
	from /Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/site_ruby/3.3.0/rubygems.rb:305:in `load'
	from /Users/<username>/.local/share/mise/installs/ruby/3.3.11/lib/ruby/site_ruby/3.3.0/rubygems.rb:305:in `activate_and_load_bin_path'
	from /Users/<username>/.local/share/mise/installs/ruby/3.3.11/bin/solargraph:36:in `<main>'

It turns out, the file environment_loader.rb was using Pathname without requiring it:

DEFAULT_CORE_ROOT = Pathname(_ = __dir__) + "../../core"

Therefore, I added the following line at the top of the file. repository.rb seemed to have a similar problem, so I added the same line for this file too:

require "pathname" unless defined?(Pathname)

I'm quite new to Ruby, so please be kind. Thanks.

@elaraspace

Copy link
Copy Markdown
Author

Oops. Sorry. I used the wrong signing key. I made another commit.

@elaraspace elaraspace changed the title Add missing dependency for environment_loader.rb Add missing dependency for environment_loader.rb and repository.rb Jun 16, 2026
austinmcconnell added a commit to austinmcconnell/dotfiles that referenced this pull request Jun 17, 2026
GEM_HOME was directing all gems into a shared directory, breaking
rbenv's per-version isolation and causing native extension conflicts.
Replace with GEMRC for XDG-compliant gemrc location only.

Add RUBYOPT="-rpathname" to work around rbs gem calling Pathname()
without requiring it (ruby/rbs#2997).

Point ALE at the global solargraph binary directly to bypass rbenv
shim failures when a project's .ruby-version isn't installed.

- Remove GEM_HOME and GEM_SPEC_CACHE from ruby.zsh
- Remove stale gem directory creation and migration from install/ruby.sh
- Update DEFAULT_RUBY_VERSION to 3.4.9
- Set ale_ruby_solargraph_executable to full path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant