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

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.

Related

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.

Project working on one computer but not the other

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.

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.

Issue installing Rubygems 2.0.3 (Ruby 2.0.0-p195) - No directory?

There I was thinking getting setup to build a RoR application would be easy. All I had to do was download Ruby, RubyGems and Rails. It's been 48 hours of headaches (rbenv can't seem to install the current version of Ruby so I had to repeat the process with RVM).
I can't install Rubygems either by running the setup file or through RVM. Here are the results:
"unknown:rubygems-2.0.3 aok617$ ruby setup.rb
/Users/aok617/rubygems-2.0.3/lib/rubygems/config_file.rb:318:in `read': Is a directory - /Users/aok617/.gemrc (Errno::EISDIR)
from /Users/aok617/rubygems-2.0.3/lib/rubygems/config_file.rb:318:in `load_file'
from /Users/aok617/rubygems-2.0.3/lib/rubygems/config_file.rb:191:in `initialize'
from /Users/aok617/rubygems-2.0.3/lib/rubygems/gem_runner.rb:66:in `new'
from /Users/aok617/rubygems-2.0.3/lib/rubygems/gem_runner.rb:66:in `do_configuration'
from /Users/aok617/rubygems-2.0.3/lib/rubygems/gem_runner.rb:46:in `run'
from setup.rb:45:in `'
unknown:rubygems-2.0.3 aok617$ "
And when I try to use RVM:
unknown:rubygems-2.0.3 aok617$ rvm install rubygems 2.0.3
Retrieving rubygems-2.0.3
Extracting rubygems-2.0.3 ...
Removing old Rubygems files...
Installing rubygems-2.0.3 for .
Error running 'env GEM_PATH=:#global GEM_HOME= /Users/aok617/.rvm/rubies//bin/ruby -d /Users/aok617/.rvm/src/rubygems-2.0.3/setup.rb',
please read /Users/aok617/.rvm/log/1372015627_rubygems.install.log
Installation of rubygems did not complete successfully.
mkdir: : No such file or directory
mkdir: : No such file or directory
unknown:rubygems-2.0.3 aok617$
The install log simply states:
[2013-06-23 20:13:14] /Users/aok617/.rvm/rubies//bin/ruby
env: /Users/aok617/.rvm/rubies//bin/ruby: No such file or directory
The common error seems to be that it is not a directory but I've followed two different sets of instructions. I don't see why the error keeps appearing.
Rbenv simple would not work installing Ruby 2.0.0. I believe this is because the gem path was not specified properly, however I have not found clear instructions for setting this up correctly. I would recommend uninstalling rbenv completely (system restore if necessary) and then performing a fresh install using RVM and Homebrew. Follow instructions on RVM website.

Ruby gem - A GEM error shown during run the commend: gem update --system

I’m a freshman on Ruby and now trying to install ruby on my machine according to the Tutorial on http://wiki.openqa.org/display/WTR/Tutorial
However, after I installed the ruby186-26, and run the command “gem update --system”, the following error occurred:
C:\Documents and Settings\e482090\Desktop>gem update --system
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/config_file.rb:51:in `initialize': Inval
id argument - <Not Set>/.gemrc (Errno::EINVAL)
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/config_file.rb:51:in `open'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/config_file.rb:51:in `initi
alize' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:36:in `new'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:36:in `do_con
figuration' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:25:in `run'
from c:/ruby/bin/gem:23
C:\Documents and Settings\e482090\Desktop>gem install watir
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/config_file.rb:51:in `initialize': Inval
id argument - <Not Set>/.gemrc (Errno::EINVAL)
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/config_file.rb:51:in `open'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/config_file.rb:51:in `initi
alize' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:36:in `new'
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:36:in `do_con
figuration' from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:25:in `run'
from c:/ruby/bin/gem:23
Meanwhile, we have tried this on other machines and the result turned out ok.
Thus, my question is why the error happened on my pc? Have you met this kind of error before?
this is caused by the version of ruby you are trying to install, which included an outdated version of rubygems that cannot auto-update itself.
since you are trying to install ruby on a windows machine, you need to get the installer from
http://rubyinstaller.org
get the latest patch release of whatever version you need - there is a 1.8.6, 1.8.7, and 1.9.1 installer available.
once you have installed the right version from this site, you will be able to run gem update --system without any issues.
Execute Below command and its works
gem install hpricot --platform=mswin32

Resources