I am trying to use Ticgit by running
ti
I get the following error message
/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- git (LoadError)
from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /opt/local/lib/ruby/gems/1.8/gems/schacon-ticgit-0.3.6/lib/ticgit.rb:8
from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /opt/local/lib/ruby/gems/1.8/gems/schacon-ticgit-0.3.6/bin/ti:9
from /opt/local/bin/ti:19:in `load'
from /opt/local/bin/ti:19
The problem may be related to MacPorts. It complains that I need to update my Xcode to the newest version, although I have the newest version.
The first line in the error message is strange, since I have the file.
What does the error message tell you?
Do you have the git rubygem installed?
"/opt/local/lib/ruby/vendor_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- git (LoadError)" means you don't have the ruby library available in your load path, not that you don't have the git binary installed.
run 'gem list -l git' and if it doesn't find the library, run 'gem install git'
Related
I'm trying to use fastlane on Windows, which is installed from Bundler -- which is installed by Ruby Gem. But while running, some internal error of Ruby seems blocked the execution.
First, I went to Ruby Installer and installed Ruby+Devkit 3.0.2-1 (x64); then, I installed the Bundler and Fastlane using gem command. Error below happened when I was trying to execute them -- which I believed was not related to Bundler nor Fastlane:
C:/Ruby30-x64/lib/ruby/3.0.0/reline/ansi.rb:157:in `winsize': Bad file descriptor - <STDIN> (Errno::EBADF)
from C:/Ruby30-x64/lib/ruby/3.0.0/reline/ansi.rb:157:in `get_screen_size'
from C:/Ruby30-x64/lib/ruby/3.0.0/reline.rb:168:in `get_screen_size'
from C:/Ruby30-x64/lib/ruby/3.0.0/forwardable.rb:238:in `get_screen_size'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/tty-screen-0.8.1/lib/tty/screen.rb:236:in `size_from_readline'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/tty-screen-0.8.1/lib/tty/screen.rb:66:in `size'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/tty-screen-0.8.1/lib/tty/screen.rb:76:in `width'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/fastlane-2.197.0/fastlane_core/lib/fastlane_core/print_table.rb:95:in `transform_output'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/fastlane-2.197.0/fastlane/lib/fastlane/plugins/plugin_manager.rb:335:in `print_plugin_information'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/fastlane-2.197.0/fastlane/lib/fastlane/plugins/plugin_manager.rb:316:in `load_plugins'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/fastlane-2.197.0/fastlane/lib/fastlane/commands_generator.rb:39:in `start'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/fastlane-2.197.0/fastlane/lib/fastlane/cli_tools_distributor.rb:122:in `take_off'
from C:/Ruby30-x64/lib/ruby/gems/3.0.0/gems/fastlane-2.197.0/bin/fastlane:23:in `<top (required)>'
from C:/Ruby30-x64/bin/fastlane:23:in `load'
from C:/Ruby30-x64/bin/fastlane:23:in `<main>'
I'm using Windows 10 home version 20H2.
Rebooting the computer doesn't solve the problem.
I tried googling the question, but it seems that problem hasn't be reported (or be answered). I don't know where I can report the bug either.
What can I do? Any help would be appreciated!
I had this same error when I tried running bundle exec fastlane in git bash.
I got it working by running it in powershell instead.
I'm running MacOS Mojave 10.14.4. I ran the command gem update and it seemed to run fine. (A lot was out of date.) However, since then, every gem command crashes like this:
$ gem --version
Traceback (most recent call last):
4: from <internal:gem_prelude>:2:in `<internal:gem_prelude>'
3: from <internal:gem_prelude>:2:in `require'
2: from /Users/tedhopp/.rvm/rubies/ruby-2.5.0/lib/ruby/site_ruby/2.5.0/rubygems.rb:1395:in `<top (required)>'
1: from /Users/tedhopp/.rvm/rubies/ruby-2.5.0/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
/Users/tedhopp/.rvm/rubies/ruby-2.5.0/lib/ruby/site_ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- rubygems/core_ext/kernel_warn (LoadError)
I also ran brew update and brew upgrade and then rebooted my system, but that didn't help. Finally, I tried downloading and reinstalling rubygems from rubygems.org, but when I ran ruby setup.rb I still got the same error. How do I fix this?
Solved my own problem. I'm posting an answer rather than deleting the question in case it helps someone else.
It turns out that I was running an outdated version of Ruby. Once I ran the following:
> rvm get stable --autolibs=enable
> rvm default 2.6.3
all the problems went away.
I'm using my work laptop to contribute to a non-work open-source project. At work we use rbenv to manage Ruby versions, but the open-source project appears to expect gem dependencies to be located in the system Ruby install folder. So when I try to run certain of the project's commands, I'm running into missing gem errors.
The project is Homebrew, and the command I'm running is brew style. When I run the command in my local, I get the following:
Ignoring rainbow-2.2.2 because its extensions are not built. Try: gem pristine rainbow --version 2.2.2
/usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- rainbow (LoadError)
from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/richie.thomas/.gem/ruby/2.3.0/gems/rubocop-0.50.0/lib/rubocop.rb:4:in `<top (required)>'
from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby/2.3.3/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/richie.thomas/.gem/ruby/2.3.0/gems/rubocop-0.50.0/bin/rubocop:6:in `<top (required)>'
from /Users/richie.thomas/.gem/ruby/2.3.0/bin/rubocop:22:in `load'
from /Users/richie.thomas/.gem/ruby/2.3.0/bin/rubocop:22:in `<main>'
Running gem environment returns the following:
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.10
- RUBY VERSION: 2.3.3 (2016-11-21 patchlevel 222) [x86_64-darwin15]
- INSTALLATION DIRECTORY: /Users/richie.thomas/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0
- USER INSTALLATION DIRECTORY: /Users/richie.thomas/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /Users/richie.thomas/.rbenv/versions/2.3.3/bin/ruby
- EXECUTABLE DIRECTORY: /Users/richie.thomas/.rbenv/versions/2.3.3/bin
- SPEC CACHE DIRECTORY: /Users/richie.thomas/.gem/specs
....
I've been advised by other contributors that the easiest path forward would be to disable or uninstall rbenv in order to run the command. I'd really like to avoid uninstalling and reinstalling rbenv every time I want to run this command, but there is nothing in the rbenv documentation that mentions this.
Is there any one-time command I can run, or any configuration setting I can change, so that I can do what I need to do?
I re-ran gem environment and noticed that the following environment variables were defined:
INSTALLATION DIRECTORY: /Users/richie.thomas/.rbenv/versions/2.3.3/lib/ruby/gems/2.3.0
USER INSTALLATION DIRECTORY: /Users/richie.thomas/.gem/ruby/2.3.0
The value of INSTALLATION DIRECTORY is what I expected to be used to run the command, and I noticed the value of USER INSTALLATION DIRECTORY is what showed up in the error stacktrace.
Since I was unable to figure out how my machine was determining which variable to use, I simply renamed ~/.gem/ to ~/.gem2/ and re-ran the brew style command I originally wanted. This was successful!
I'm using Cloud9 IO for Ruby.
I ran bundle install.
Even installed the gems.
But I'm still getting this error.
scarletmclearn:~/workspace/nokogiri_tutorial (master) $ ruby
web_scraper.rb
/usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
require': cannot load such file -- Nokogiri (LoadError)
from /usr/local/rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in
require'
from web_scraper.rb:1:in `'
Do check out my Repository : https://github.com/ScarletMcLearn/ruby_ws_1/tree/master/workspace
a beginner here, so simple instructions on which file or what to change will help.
Thanks for the read!
from your command prompt install nokogiri by running
gem install nokogiri
A heads up that I'm in no way a Ruby expert...I just use it from time to time for basic scripting. I'm trying to use the RubyCocoa framework so that I can use additional commands in my Ruby script.
As an example, if I was to try something as explicit as this:
#!/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
require '/System/Library/Frameworks/RubyCocoa.framework/Versions/A/Resources/ruby/osx/cocoa.rb'
puts "Hello, World"
I receive this error:
/usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- osx/objc/cocoa.rb (LoadError)
from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /System/Library/Frameworks/RubyCocoa.framework/Versions/A/Resources/ruby/osx/cocoa.rb:8:in `<top (required)>'
from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from Test.rb:4:in `<main>'
I do have Homebrew installed on my Mac (running 10.10), but why does the require command go through to the Cellar folder? You can see I'm trying to use the 2.0 Ruby version from my Frameworks folder (the one in /usr/bin is still 1.9.3 (would also love for someone to explain how these versions differ and why)).
It goes through the Cellar folder because it is in your load path.
You can examine your load path by writing in your script
puts $:
Concerning your error message
You can use fully qualified path in require so
require '/System/Library/Frameworks/RubyCocoa.framework/Versions/A/Resources/ruby/osx/cocoa.rb'
is correct.
And indeed in your error message you can see this line
from /System/Library/Frameworks/RubyCocoa.framework/Versions/A/Resources/ruby/osx/cocoa.rb:8:in `<top (required)>'
So you correctly required your file
However from the first line of your error message.
usr/local/Cellar/ruby/1.9.3-p194/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- osx/objc/cocoa.rb (LoadError)
We can see ruby/osx/cocoa.rb tries to require another file. This one is different and found under osx/objc/cocoa.rb. So those files have similar names but are different.
And since it tries to require with require 'osx/objc/cocoa.rb' it fails because it does not know how to find it (not a fully qualified path here).
Maybe you can try to change the load path variable.
By adding the line:
$: << '/System/Library/Frameworks/RubyCocoa.framework/Versions/A/Resources/ruby/osx/objc/'
It might work but I’m not sure since I don’t know where that osx/obj folder is located on your machine.
you might want to take some time to clean your ruby installation and maybe instead a fresh ruby using rvm or rbenv (I prefer rbenv)