Project working on one computer but not the other - ruby

My ruby project is working fine on one of my Macbooks, but on the other I get this error:
Traceback (most recent call last):
13: from bin/audiobook-now:5:in `<main>'
12: from /Users/TuzsNewMacBook/Development/code/audiobook-now-cli/lib/cli.rb:50:in `run'
11: from /Users/TuzsNewMacBook/Development/code/audiobook-now-cli/lib/cli.rb:7:in `get_books_from'
10: from /Users/TuzsNewMacBook/Development/code/audiobook-now-cli/lib/scraper.rb:7:in `scrape_book_list'
9: from /Users/TuzsNewMacBook/.rvm/gems/ruby-2.5.1/gems/capybara-2.18.0/lib/capybara/session.rb:274:in `visit'
8: from /Users/TuzsNewMacBook/.rvm/gems/ruby-2.5.1/gems/poltergeist-1.18.1/lib/capybara/poltergeist/driver.rb:100:in `visit'
7: from /Users/TuzsNewMacBook/.rvm/gems/ruby-2.5.1/gems/poltergeist-1.18.1/lib/capybara/poltergeist/driver.rb:27:in `browser'
6: from /Users/TuzsNewMacBook/.rvm/gems/ruby-2.5.1/gems/poltergeist-1.18.1/lib/capybara/poltergeist/driver.rb:47:in `client'
5: from /Users/TuzsNewMacBook/.rvm/gems/ruby-2.5.1/gems/poltergeist-1.18.1/lib/capybara/poltergeist/client.rb:16:in `start'
4: from /Users/TuzsNewMacBook/.rvm/gems/ruby-2.5.1/gems/poltergeist-1.18.1/lib/capybara/poltergeist/client.rb:16:in `new'
3: from /Users/TuzsNewMacBook/.rvm/gems/ruby-2.5.1/gems/poltergeist-1.18.1/lib/capybara/poltergeist/client.rb:53:in `initialize'
2: from /Users/TuzsNewMacBook/.rvm/gems/ruby-2.5.1/gems/cliver-0.3.2/lib/cliver.rb:24:in `detect!'
1: from /Users/TuzsNewMacBook/.rvm/gems/ruby-2.5.1/gems/cliver-0.3.2/lib/cliver/dependency.rb:116:in `detect!'
/Users/TuzsNewMacBook/.rvm/gems/ruby-2.5.1/gems/cliver-0.3.2/lib/cliver/dependency.rb:143:in `raise_not_found!': Could not find an executable ["phantomjs"] on your path. (Cliver::Dependency::NotFound)
I had been getting similar problems at various points and most of the fixes were in the code (some require statements were looping around to each other), but the program works on my other Macbook without these errors. Their repos are synced, I've even tried looking at the code to make sure they're identical. I've also used bundle list to compare the versions of the gems and they match. Here's the gemfile, in case it's helpful.
source "https://rubygems.org"
gem 'pry'
gem 'pry-rescue'
gem 'pry-stack_explorer'
gem 'pry-nav'
gem 'poltergeist'
gem 'nokogiri'
gem 'rspec'
gem 'require_all'
Both Macbooks are running the same version of Mojave and I don't think there's anything different about the systems that would cause this. They should all be on the same version of gems and bundlers etc.
Any ideas?

This line
/Users/TuzsNewMacBook/.rvm/gems/ruby-2.5.1/gems/cliver-0.3.2/lib/cliver/dependency.rb:143:in `raise_not_found!': Could not find an executable ["phantomjs"] on your path. (Cliver::Dependency::NotFound)
explains why your project does not work on another computer.
Gem poltergeist is a PhantomJS driver for Capybara. To make it work you need to install phantomjs (a headless browser). You could download it from PhantomJS official site:
http://phantomjs.org/download.html
Make sure you're installing the same version. To do so run this command in Terminal of 1st Macbook:
phantomjs -v
to find out the installed version, and install the same version on the 2nd Macbook.

Related

kernel_gem.rb:67:in `synchronize': deadlock; recursive locking (ThreadError)

when I run this command on macOS Big Sur 11.2.3:
pod setup
shows this error:
$ pod setup ‹ruby-2.7.2›
Traceback (most recent call last):
12: from /Users/dolphin/.rvm/gems/ruby-2.7.2/bin/ruby_executable_hooks:22:in `<main>'
11: from /Users/dolphin/.rvm/gems/ruby-2.7.2/bin/ruby_executable_hooks:22:in `eval'
10: from /Users/dolphin/.rvm/gems/ruby-2.7.2/bin/pod:23:in `<main>'
9: from /Users/dolphin/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems.rb:304:in `activate_bin_path'
8: from /Users/dolphin/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems.rb:304:in `synchronize'
7: from /Users/dolphin/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems.rb:306:in `block in activate_bin_path'
6: from /Users/dolphin/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems.rb:243:in `finish_resolve'
5: from /Users/dolphin/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/request_set.rb:435:in `resolve_current'
4: from /Users/dolphin/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/request_set.rb:435:in `new'
3: from /Users/dolphin/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/resolver/set.rb:24:in `initialize'
2: from /Users/dolphin/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:42:in `require'
1: from /Users/dolphin/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_gem.rb:67:in `gem'
/Users/dolphin/.rvm/rubies/ruby-2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_gem.rb:67:in `synchronize': deadlock; recursive locking (ThreadError)
(base)
I am searching from internet but did not found some useful imformation about this problem. I have tried to reinstall cocoapods still not fix this. what should I do to fix this problem? this is my ruby env:
~/source/cruise-open on  main ⌚ 13:37:15
$ rvm list ‹ruby-2.7.2›
=* ruby-2.7.2 [ x86_64 ]
ruby-3.0.0 [ x86_64 ]
# => - current
# =* - current && default
# * - default
(base)
right now I found run pod install command still show this error.
Updating RubyGems did the trick for me.
https://guides.rubygems.org/command-reference/#gem-update
gem update --system
This error must be for any rails application. Check the ruby and rails version from the Gemfile. In my case, it's ruby 3.1.2 and rails 7.0.4.
Reinstall or Install the dependencies again. Ruby 3.1.2 is already there in my system but I reinstalled in order to fix this issue.
Remove the bundler from /.rvm/gems/ruby-3.1.2/cache
rm -rf bundler-2.3.25.gem
My Gemfile.lock was bundled with 2.3.25
And remove ruby from /.rvm/gems
rm -rf ruby-3.1.2
Now the error will be changed when you install rails or bundle to something
invalid gem: package is corrupt, exception while verifying: wrong number of arguments (given 2, expected 1) (ArgumentError) in /Users/anjanasingh/.rvm/gems/ruby-3.1.2/cache/concurrent-ruby-1.1.10.gem
Now, uninstall ruby using rvm(Yes, rvm works in my case though I used rbenv for setting the ruby versions)
rvm uninstall "ruby-3.1.2
Install ruby
rvm install "ruby-3.1.2"
bundle your application
bundle install
Rails is still not there. So, install rails
gem install rails -v 7.0.4
I have tried with 'rbenv install 3.1.2' and reinstall, installenter image description here multiple times but it was not working with rbenv. Finally rvm worked.

selenium/webdriver/firefox/binary.rb:134:in `path': can't modify frozen String (FrozenError)

I tried to run a simple google look up code in selenium and ran it on EC2 instance(Amazon Linux). I am getting an error launching Firefox and cannot understand what the error means.
Ruby version - ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
selenium-webdriver version - 3.142.3
require 'selenium-webdriver'
options = Selenium::WebDriver::Firefox::Options.new(args: ['-headless'])
driver = Selenium::WebDriver.for(:firefox, options: options)
driver.get "http://google.com"
puts "Page title is #{driver.title}"
driver.quit
When running ruby test.rb
Traceback (most recent call last):
8: from test.rb:4:in `<main>'
7: from /usr/local/rvm/gems/ruby-2.6.3/gems/selenium-webdriver-3.142.3/lib/selenium/webdriver.rb:88:in `for'
6: from /usr/local/rvm/gems/ruby-2.6.3/gems/selenium-webdriver-3.142.3/lib/selenium/webdriver/common/driver.rb:54:in `for'
5: from /usr/local/rvm/gems/ruby-2.6.3/gems/selenium-webdriver-3.142.3/lib/selenium/webdriver/firefox/driver.rb:33:in `new'
4: from /usr/local/rvm/gems/ruby-2.6.3/gems/selenium-webdriver-3.142.3/lib/selenium/webdriver/firefox/driver.rb:33:in `new'
3: from /usr/local/rvm/gems/ruby-2.6.3/gems/selenium-webdriver-3.142.3/lib/selenium/webdriver/firefox/marionette/driver.rb:38:in `initialize'
2: from /usr/local/rvm/gems/ruby-2.6.3/gems/selenium-webdriver-3.142.3/lib/selenium/webdriver/common/driver.rb:299:in `service_url'
1: from /usr/local/rvm/gems/ruby-2.6.3/gems/selenium-webdriver-3.142.3/lib/selenium/webdriver/common/service.rb:45:in `firefox'
/usr/local/rvm/gems/ruby-2.6.3/gems/selenium-webdriver-3.142.3/lib/selenium/webdriver/firefox/binary.rb:134:in `path': can't modify frozen String (FrozenError)
Need some help here.
You'll get that error if Firefox isn't installed, or isn't accessible on your path.
Reinstall if you already have it.
Also, as of selenium-webdriver 3.142.3, you can check the current Firefox binary path using this:
Selenium::WebDriver::Firefox::Binary.path
This would throw this same FrozenError if no binary is found, and return the binary path if a Firefox binary has been found somewhere.
Also worth mentioning that an issue has been opened in the selenium-webdriver repo to make the error message more explanatory, if you're interested.

Cannot run gem after updating

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.

TypeError in installing ruby gems on CygWin

I have installed ruby 2.2.5 / gem 2.3.0 in CygWin but I am getting installation errors in using gem install.
As suggested in some places, I also tried gem update --system but even that did not help.
How to correct this issue?
I have attached the output of the commands I ran:
$ gem install napa --backtrace
ERROR: While executing gem ... (TypeError)
no implicit conversion of nil into String
/usr/local/share/ruby/site_ruby/rubygems/installer.rb:168:in `check_executable_overwrite'
/usr/local/share/ruby/site_ruby/rubygems/installer.rb:409:in `block in generate_bin'
/usr/local/share/ruby/site_ruby/rubygems/installer.rb:396:in `each'
/usr/local/share/ruby/site_ruby/rubygems/installer.rb:396:in `generate_bin'
/usr/local/share/ruby/site_ruby/rubygems/installer.rb:236:in `install'
/usr/local/share/ruby/site_ruby/rubygems/request_set.rb:156:in `block in install'
/usr/local/share/ruby/site_ruby/rubygems/request_set.rb:140:in `each'
/usr/local/share/ruby/site_ruby/rubygems/request_set.rb:140:in `install'
/usr/local/share/ruby/site_ruby/rubygems/commands/install_command.rb:249:in `install_gem'
/usr/local/share/ruby/site_ruby/rubygems/commands/install_command.rb:291:in `block in install_gems'
/usr/local/share/ruby/site_ruby/rubygems/commands/install_command.rb:287:in `each'
/usr/local/share/ruby/site_ruby/rubygems/commands/install_command.rb:287:in `install_gems'
/usr/local/share/ruby/site_ruby/rubygems/commands/install_command.rb:202:in `execute'
/usr/local/share/ruby/site_ruby/rubygems/command.rb:307:in `invoke_with_build_args'
/usr/local/share/ruby/site_ruby/rubygems/command_manager.rb:167:in `process_args'
/usr/local/share/ruby/site_ruby/rubygems/command_manager.rb:137:in `run'
/usr/local/share/ruby/site_ruby/rubygems/gem_runner.rb:54:in `run'
/usr/bin/gem:21:in `<main>'
$ gem update --system
Updating rubygems-update
ERROR: While executing gem ... (TypeError)
no implicit conversion of nil into String
Skip to the bottom for the short answer and not join me on my journey.
So I've been working on this today because for the life of me, what worked last year to get it working did not work this year. All the steps are attempted while using admin permissions. I had done some questionable commands from other threads that required me to downgrade gem to something 6 years ago, don't do that I could not figure out how to revert so I deleted my Cygwin install and started fresh and clean for this. Windows 10 is my operating system.
I used cygwin's installer to install the current version of ruby, gem and sass. (I'm positive as time goes on these will numbers will become out of date).
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-cygwin]
ruby-devel 2.3.3-1
gem 2.6.11
Sass 3.4.21 selective steve
Side note I tend to use 'Category' under the View drop down and select the devel category. I also let cygwin select dependencies for me automatically.
At this point I am having the same error. Looking at the log provided by the output I decided to try out some of the commands smashed in there like 'gcc' which was absent. Loading up the cygwin installer again, installed gcc version 5.4.0 (Package called gcc-core: GNU Compiler Collection (C, OpenMP))
Attempting to run 'gem install compass' again, another error, it cant find 'make'. Warm up the installer again and locate 'make: The GNU Version of the 'make' utility (4.2.1-2)
Running the compass install command again and checking the log: 'libffi' doesnt look like its there. In our cygwin installer says under the libs category I have libffi6 v2.2.1-2 already. I'm going to give libffi-devel a shot because I'm desperate to get compass installed.
This worked! Navigate to your directory and run the command 'compass watch' I'm pretty excited. Running 'compass -v' in the command line shows us the version 1.0.3
Short answer:
Useing the Cygwin installer to install the following Packages
ruby: interpreted object oriented scripting language
ruby-devel: interpreted object oriented scripting language
ruby-gems: Ruby Module management system
ruby-sass: Ruby css compiler extension
make: The GNU version of the make utility
gcc-core: GNU Compiler Collection(c, OpenMP)
libffi-devel: Portable foreign function interface libary
Then run cygwin as a administrator and input the command 'gem install compass'.

Invalid spec cache file

I have ruby 2.0.0p247 [x64-mingw32] with Gem 2.2.2 installed on Windows 8. I have a persistent problem gem that is making it virtually unusable. Whenever I try to install a new gem, I invariably get:
ERROR: While executing gem ... Invalid spec cache file in C:/Users/...
In the past, I've been able to run gem update or gem update --system and that would clear up the problem for one, single gem install. Subsequent install would fail with the same error. Now even gem update fails with that error message.
I've tried deleting the users/.../.gem directory. When I do that, gem update recreates that directory and promptly fails with the same error message.
I re-installed ruby 1.9.8 with gems several times to try to cure the problem, then upgraded to ruby 2.0.0. Throughout all re-installs and upgrades, the problem persisted.
I'm at my wits end here. Can anyone help me resolve this issue?
Here's the backtrace on the edit"
L:\xampp\htdocs\frameworks\yii2\framework>gem update --backtrace
Updating installed gems
ERROR: While executing gem ... (Gem::Exception)
Invalid spec cache file in C:/Users/Larry/.gem/specs/rubygems.org%443/specs.4.8
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/source.rb:187:in `rescue in load_specs'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/source.rb:179:in `load_specs'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/spec_fetcher.rb:266:in `tuples_for'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/spec_fetcher.rb:228:in `block in available_specs'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/source_list.rb:97:in `each'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/source_list.rb:97:in `each_source'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/spec_fetcher.rb:222:in `available_specs'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/spec_fetcher.rb:102:in `search_for_dependency'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/commands/update_command.rb:113:in `fetch_remote_gems'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/commands/update_command.rb:135:in `highest_remote_version'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/commands/update_command.rb:264:in `block in which_to_update'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/commands/update_command.rb:260:in `each'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/commands/update_command.rb:260:in `which_to_update'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/commands/update_command.rb:96:in `execute'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/command.rb:305:in `invoke_with_build_args'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/command_manager.rb:167:in `process_args'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/command_manager.rb:137:in `run'
C:/Ruby200-x64/lib/ruby/site_ruby/2.0.0/rubygems/gem_runner.rb:54:in `run'
C:/Ruby200-x64/bin/gem:21:in `<main>'
I had the same problem, but was able to fix it this way:
Delete the folder in users/%user%/.gem/ and rerun the command gem sources --update
Hope this helps.

Resources