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
Problem requiring "prism/translation/parser33" #2803
Comments
domingo2000
changed the title
Problem requiring "prism/translation/parser33" using bundler.
Problem requiring "prism/translation/parser33"
May 12, 2024
koic
added a commit
to koic/prism
that referenced
this issue
May 13, 2024
Resolves ruby#2803. This PR adds error handling for missing `parser` gem in `Prism::Translation`. The `parser` gem is a required runtime dependency when using `Prism::Translation::Parser`. But it is not required for other uses of Prism. To avoid unnecessary dependencies, it is not added as a `runtime_dependency` in the prism.gemspec. Instead, if the dependency is missing, instructions are given to add it to Gemfile. ## Before ```console $ bundle exec ruby -e 'require "prism"; require "prism/translation/parser33"' /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require': cannot load such file -- parser (LoadError) from /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require' from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser.rb:3:in `<top (required)>' from /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require' from /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require' from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser33.rb:6:in `<module:Translation>' from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser33.rb:4:in `<module:Prism>' from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser33.rb:3:in `<top (required)>' from /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require' from /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require' from -e:1:in `<main>' ``` ## After ```console $ bundle exec ruby -e 'require "prism"; require "prism/translation/parser33"' Error: Unable to load parser. Add `gem "parser"` to your Gemfile. ```
matzbot
pushed a commit
to ruby/ruby
that referenced
this issue
May 13, 2024
…ranslation` Resolves ruby/prism#2803. This PR adds error handling for missing `parser` gem in `Prism::Translation`. The `parser` gem is a required runtime dependency when using `Prism::Translation::Parser`. But it is not required for other uses of Prism. To avoid unnecessary dependencies, it is not added as a `runtime_dependency` in the prism.gemspec. Instead, if the dependency is missing, instructions are given to add it to Gemfile. ## Before ```console $ bundle exec ruby -e 'require "prism"; require "prism/translation/parser33"' /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require': cannot load such file -- parser (LoadError) from /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require' from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser.rb:3:in `<top (required)>' from /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require' from /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require' from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser33.rb:6:in `<module:Translation>' from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser33.rb:4:in `<module:Prism>' from /Users/koic/src/github.com/ruby/prism/lib/prism/translation/parser33.rb:3:in `<top (required)>' from /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `require' from /Users/koic/.rbenv/versions/3.3.1/lib/ruby/3.3.0/bundled_gems.rb:74:in `block (2 levels) in replace_require' from -e:1:in `<main>' ``` ## After ```console $ bundle exec ruby -e 'require "prism"; require "prism/translation/parser33"' Error: Unable to load parser. Add `gem "parser"` to your Gemfile. ``` ruby/prism@4880aec22d
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found a bug when loading the "prism/translation/parser33" using rubocop with bundler. I could reproduce the same error only requiring prism abd parser33 so the problem is actually from the prism gem parser and not from rubocop.
Current behaviour
When runing
it throws error because the file
versions/3.3.1/lib/ruby/gems/3.3.0/gems/prism-0.29.0/lib/prism/translation/parser.rb
cannot load theparser
gem. Here is the full logThis affects the running of rubocop when running with bundler. Here is all my enviroment information to reproduce the problem
Ruby Version: ruby 3.3.1 (2024-04-23 revision c56cd86388) [x86_64-linux]
OS: Ubuntu 22.04.3 LTS (In Windows 10 WSL)
Gemfile:
Gemfile.lock:
The text was updated successfully, but these errors were encountered: