Installation error: undefined local variable or method `__dir__' for main:Object (NameError)
tooh opened this issue · comments
/Users/peter/.rvm/gems/ruby-1.9.3-p547/gems/md2key-0.4.4/bin/md2key:3:in `<top (required)>': undefined local variable or method `__dir__' for main:Object (NameError)
from /Users/peter/.rvm/gems/ruby-1.9.3-p547/bin/md2key:23:in `load'
from /Users/peter/.rvm/gems/ruby-1.9.3-p547/bin/md2key:23:in `<main>'
from /Users/peter/.rvm/gems/ruby-1.9.3-p547/bin/ruby_executable_hooks:15:in `eval'
from /Users/peter/.rvm/gems/ruby-1.9.3-p547/bin/ruby_executable_hooks:15:in `<main>'
Thank you for trying md2key!
Your ruby's version is 1.9.3 and Ruby 1.9.3 does not have __dir__
.
I can change the code to work with 1.9.3 but the version is no longer supported officially. https://www.ruby-lang.org/en/news/2014/01/10/ruby-1-9-3-will-end-on-2015/
Could you update your Ruby version to 2.0 or higher?
Upgraded Ruby
rvm use ruby-2.2.1
Works OK now. Thanks for the help.
Issue can be closed.
I'm glad to hear that! :)
Hello! I have similair problem
There are a lot of this rows in debug output
Error: .../node_modules/@prettier/plugin-ruby/src/ripper.rb:8:in '<main>': undefined local variable or method 'current_version' for main:Object (NameError)
ruby -v
ruby 2.4.9p362 (2019-10-02 revision 67824) [x86_64-darwin19]
UPD: anyway - update to ruby 2.6.1 solved this issue, so if u came here from googling this error same as me - u might try it as well
It seems like a different issue, and it's an error inside node_modules prettier. md2key doesn't use ripper and therefore the error has nothing to do with this repository. Please go to https://github.com/prettier/prettier, or try uninstalling prettier from your environment.
Ohhh, snap, my bad, sorry)