Rbenv wrong gem installation path - can't find gem - ruby

I'm having an issue with rbenv and what I believe is an issue is of require trying to read from my system gems rather than from shims.
I'm trying to create a single script file without the overhead of needing bundle - though I've tried adding a Gemfile and put the script and Gemfile in the same directory.
Reproducible steps:
brew install rbenv
export PATH="$HOME/.rbenv/bin:$PATH" in my .zshrc
Add eval "$(rbenv init -)" to my .zshrc
Source: . ~/.zshrc
rbenv install 2.6.3
rbenv rehash
rbenv global 2.6.3
rbenv rehash for brevity
Close terminal
New terminal:
ruby -v = "ruby 2.6.3p62"
rbenv version = "2.6.3 (set by $HOME/Desktop/.ruby-version)"
which ruby = "$HOME/.rbenv/shims/ruby"
gem env
INSTALLATION DIRECTORY: $HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0
USER INSTALLATION DIRECTORY: $HOME/.gem/ruby/2.6.0
RUBY EXECUTABLE: $HOME/.rbenv/versions/2.6.3/bin/ruby
EXECUTABLE DIRECTORY: $HOME/.rbenv/versions/2.6.3/bin
SPEC CACHE DIRECTORY: $HOME/.gem/specs
SYSTEM CONFIGURATION DIRECTORY: $HOME/.rbenv/versions/2.6.3/etc
RUBYGEMS PLATFORMS:
ruby
x86_64-darwin-18
GEM PATHS:
$HOME/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0
$HOME/.gem/ruby/2.6.0
gem install colorize - this gem seems to work fine
gem install httparty
gem install pry
File header:
#!/usr/bin/ruby
require 'httparty'
require 'colorize'
require 'pry'
./file.rb
Stack Trace for HTTParty
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/dependency.rb:319:in 'to_specs': Could not find 'multi_xml' (>= 0.5.2) among 17 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=$HOME/.gem/ruby/2.3.0:/Library/Ruby/Gems/2.3.0:/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/gems/2.3.0', execute `gem env` for more information
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:1442:in `block in activate_dependencies'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:1431:in `each'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:1431:in `activate_dependencies'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/specification.rb:1413:in `activate'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:196:in `rescue in try_activate'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems.rb:193:in `try_activate'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:125:in `rescue in require'
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:39:in `require'
from ./cdw-demo.rb:3:in `<main>'
Stack trace for Pry
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- pry (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from ./cdw-demo.rb:4:in `<main>'
The stack trace shows there maybe in issue with multi_xml being a missing gem, but that was installed with httparty
Gem list:
gem list
*** LOCAL GEMS ***
bigdecimal (default: 1.4.1)
bundler (2.1.4, default: 1.17.2)
cmath (default: 1.0.0)
coderay (1.1.2)
colorize (0.8.1)
csv (default: 3.0.9)
date (default: 2.0.0)
dbm (default: 1.0.0)
did_you_mean (1.3.0)
e2mmap (default: 0.1.0)
etc (default: 1.0.1)
fcntl (default: 1.0.0)
fiddle (default: 1.0.0)
fileutils (default: 1.1.0)
forwardable (default: 1.2.0)
gdbm (default: 2.0.0)
httparty (0.17.3)
io-console (default: 0.4.7)
ipaddr (default: 1.2.2)
irb (default: 1.0.0)
json (default: 2.1.0)
logger (default: 1.3.0)
matrix (default: 0.1.0)
method_source (0.9.2)
mime-types (3.3.1)
mime-types-data (3.2019.1009)
minitest (5.11.3)
multi_xml (0.6.0)
mutex_m (default: 0.1.0)
net-telnet (0.2.0)
openssl (default: 2.1.2)
ostruct (default: 0.1.0)
power_assert (1.1.3)
prime (default: 0.1.0)
pry (0.12.2)
psych (default: 3.1.0)
rake (12.3.2)
rdoc (default: 6.1.0)
rexml (default: 3.1.9)
rss (default: 0.2.7)
scanf (default: 1.0.0)
sdbm (default: 1.0.0)
shell (default: 0.7)
stringio (default: 0.0.2)
strscan (default: 1.0.0)
sync (default: 0.5.0)
test-unit (3.2.9)
thwait (default: 0.1.0)
tracer (default: 0.1.0)
webrick (default: 1.4.2)
xmlrpc (0.3.0)
zlib (default: 1.0.0)
Let me know if anymore information is needed.

Rather than using /usr/bin/ruby which is the system installed Ruby, use the hashbang
#!/usr/bin/env ruby
This should point to your global rbenv backed Ruby.

Related

aws-sdk-core/xml/parser.rb:74:in `set_default_engine': Unable to find a compatible xml library), Ruby version 3.0.2

I am having a legacy ruby daemon script that runs on a linux server. On upgrading all ruby and gem package versions with in the instance, the daemon script is now erroring out. Same error I am getting with in irb
**
/home/ec2-user/.local/share/gem/ruby/gems/aws-sdk-core-3.121.0/lib/aws-sdk-core/xml/parser.rb:74:in `set_default_engine': Unable to find a compatible xml library. Ensure that you have installed or added to your Gemfile one of ox, oga, libxml, nokogiri or rexml (RuntimeError)
from /home/ec2-user/.local/share/gem/ruby/gems/aws-sdk-core-3.121.0/lib/aws-sdk-core/xml/parser.rb:96:in `<class:Parser>'
from /home/ec2-user/.local/share/gem/ruby/gems/aws-sdk-core-3.121.0/lib/aws-sdk-core/xml/parser.rb:7:in `<module:Xml>'
from /home/ec2-user/.local/share/gem/ruby/gems/aws-sdk-core-3.121.0/lib/aws-sdk-core/xml/parser.rb:5:in `<module:Aws>'
from /home/ec2-user/.local/share/gem/ruby/gems/aws-sdk-core-3.121.0/lib/aws-sdk-core/xml/parser.rb:3:in `<top (required)>'
from /home/ec2-user/.local/share/gem/ruby/gems/aws-sdk-core-3.121.0/lib/aws-sdk-core/xml.rb:8:in `require_relative'
from /home/ec2-user/.local/share/gem/ruby/gems/aws-sdk-core-3.121.0/lib/aws-sdk-core/xml.rb:8:in `<top (required)>'
from /home/ec2-user/.local/share/gem/ruby/gems/aws-sdk-core-3.121.0/lib/aws-sdk-core.rb:68:in `require_relative'
from /home/ec2-user/.local/share/gem/ruby/gems/aws-sdk-core-3.121.0/lib/aws-sdk-core.rb:68:in `<top (required)>'
from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require'
from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require'
from /home/ec2-user/.local/share/gem/ruby/gems/aws-sdk-kms-1.48.0/lib/aws-sdk-kms.rb:11:in `<top (required)>'
from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require'
from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require'
from /home/ec2-user/.local/share/gem/ruby/gems/aws-sdk-s3-1.102.0/lib/aws-sdk-s3.rb:11:in `<top (required)>'
from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:160:in `require'
from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:160:in `rescue in require'
... 5 levels...
<internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- aws-sdk-s3 (LoadError)
from <internal:/usr/share/rubygems/rubygems/core_ext/kernel_require.rb>:85:in `require'
from (irb):1:in `<main>'
from /usr/share/gems/gems/irb-1.3.5/exe/irb:11:in `<top (required)>'
from /usr/bin/irb:23:in `load'
from /usr/bin/irb:23:in `<main>'
**
aws-sdk-core version : 3.121.0
output for gem list
**
*** LOCAL GEMS ***
abbrev (default: 0.1.0)
aws-eventstream (1.2.0)
aws-partitions (1.501.0)
aws-sdk-core (3.121.0)
aws-sdk-kms (1.48.0)
aws-sdk-s3 (1.102.0)
aws-sdk-sqs (1.44.0)
aws-sigv4 (1.4.0)
base64 (default: 0.1.0)
benchmark (default: 0.1.1)
bigdecimal (3.0.0)
bundler (2.2.22)
cgi (default: 0.2.0)
csv (default: 3.1.9)
daemons (1.4.1)
date (default: 3.1.0)
dbm (default: 1.1.0)
debug (default: 0.1.0)
delegate (default: 0.2.0)
did_you_mean (default: 1.5.0)
digest (default: 3.0.0)
drb (default: 2.0.4)
english (default: 0.7.1)
erb (default: 2.2.0)
etc (default: 1.2.0)
fcntl (default: 1.0.0)
fiddle (default: 1.0.6)
fileutils (default: 1.5.0)
find (default: 0.1.0)
forwardable (default: 1.3.2)
gdbm (default: 2.1.0)
getoptlong (default: 0.1.1)
io-console (0.5.7)
io-nonblock (default: 0.1.0)
io-wait (default: 0.1.0)
ipaddr (default: 1.2.2)
irb (1.3.5)
jmespath (1.4.0)
json (2.5.1)
logger (default: 1.4.3)
matrix (default: 0.3.1)
mutex_m (default: 0.1.1)
net-ftp (default: 0.1.2)
net-http (default: 0.1.1)
net-imap (default: 0.1.1)
net-pop (default: 0.1.1)
net-protocol (default: 0.1.0)
net-smtp (default: 0.2.1)
nkf (default: 0.1.0)
observer (default: 0.1.1)
open-uri (default: 0.1.0)
open3 (default: 0.1.1)
openssl (default: 2.2.0)
optparse (default: 0.1.0)
ostruct (default: 0.3.1)
pathname (default: 0.1.0)
pp (default: 0.1.0)
prettyprint (default: 0.1.0)
prime (default: 0.1.2)
pstore (default: 0.1.1)
psych (3.3.0)
racc (default: 1.5.1)
rake (13.0.3)
rdoc (6.3.1)
readline (default: 0.0.2)
readline-ext (default: 0.1.1)
reline (default: 0.2.5)
resolv (default: 0.2.0)
resolv-replace (default: 0.1.0)
rinda (default: 0.1.0)
rubysl-securerandom (2.0.0)
securerandom (default: 0.1.0)
set (default: 1.0.1)
shellwords (default: 0.1.0)
singleton (default: 0.1.1)
stringio (default: 3.0.0)
strscan (default: 3.0.0)
syslog (default: 0.1.0)
tempfile (default: 0.1.1)
time (default: 0.1.0)
timeout (default: 0.1.1)
tmpdir (default: 0.1.2)
tracer (default: 0.1.1)
tsort (default: 0.1.0)
un (default: 0.1.0)
uri (default: 0.10.1)
weakref (default: 0.1.1)
yaml (default: 0.1.1)
zlib (default: 1.1.0)
**
output for gem env
**
RubyGems Environment:
- RUBYGEMS VERSION: 3.2.22
- RUBY VERSION: 3.0.2 (2021-07-07 patchlevel 107) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/share/gems
- USER INSTALLATION DIRECTORY: /home/ec2-user/.local/share/gem/ruby
- RUBY EXECUTABLE: /usr/bin/ruby
- GIT EXECUTABLE:
- EXECUTABLE DIRECTORY: /usr/bin
- SPEC CACHE DIRECTORY: /home/ec2-user/.local/share/gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/share/gems
- /home/ec2-user/.local/share/gem/ruby
- /usr/local/share/gems
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--user-install --bindir /home/ec2-user/bin"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /usr/local/bin
- /usr/bin
- /usr/local/sbin
- /usr/sbin
- /home/ec2-user/.local/bin
- /home/ec2-user/bin
**
Any help would really be appreciated.
In my case, I just did gem install nokogiri and it is working here.
Perhaps the context/env your daemon script gets is different than running locally, though I'm surprised irb gives the same issue in that case.
For people checking this thread in future, rexml was moved from default to bundled gems in ruby 3.0.0. If aws-sdk-core was working for you before update to ruby 3, all you need to do is add rexml to your gemfile.
Of course previous answers will work, as mentioned in error message any xml library is fine.
The issue got resolved after installing few dependency packages
yum -y install gcc mysql-devel ruby-devel rubygems
and then installing nokogiri worked fine

Can't get rid of local gems

I am trying to uninstall ruby and start over. I am can't get fastlane to work because of all the ruby errors - can't find installed gems, etc. I don't code in ruby and have not used gems before this.
So how do I really start fresh?
Environment:
I am on Big Sur
Installed ruby with brew
Added packages with gem
I have a local Gemfile that looked like
gem "dotenv"
gem "fastlane"
I did this:
% gem uninstall -aIx
INFO: Uninstalled all gems in
and
gem clean
Cleaning up installed gems...
Clean up complete
It looks like it should be showing me a folder here. Not sure if that's a clue.
I also blanked my Gemfile and did
bundle clean --force
Now when I do gem list I still have local gems
% gem list
*** LOCAL GEMS ***
bigdecimal (default: 1.4.1)
bundler (default: 1.17.2)
CFPropertyList (2.3.6)
cmath (default: 1.0.0)
csv (default: 3.0.9)
date (default: 2.0.0)
dbm (default: 1.0.0)
e2mmap (default: 0.1.0)
etc (default: 1.0.1)
fcntl (default: 1.0.0)
fiddle (default: 1.0.0)
fileutils (default: 1.1.0)
forwardable (default: 1.2.0)
io-console (default: 0.4.7)
ipaddr (default: 1.2.2)
irb (default: 1.0.0)
json (default: 2.1.0)
libxml-ruby (3.1.0)
logger (default: 1.3.0)
matrix (default: 0.1.0)
mini_portile2 (2.4.0)
mutex_m (default: 0.1.0)
nokogiri (1.10.1)
openssl (default: 2.1.2)
ostruct (default: 0.1.0)
prime (default: 0.1.0)
psych (default: 3.1.0)
rdoc (default: 6.1.0)
rexml (default: 3.1.9)
rss (default: 0.2.7)
scanf (default: 1.0.0)
sdbm (default: 1.0.0)
shell (default: 0.7)
sqlite3 (1.3.13)
stringio (default: 0.0.2)
strscan (default: 1.0.0)
sync (default: 0.5.0)
thwait (default: 0.1.0)
tracer (default: 0.1.0)
webrick (default: 1.4.2)
zlib (default: 1.0.0)
I also see gems in all of the folders listed by gem env
- /Users/me/.gem/ruby/2.6.0
- /Library/Ruby/Gems/2.6.0
- /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0

Could not find 'minitest' (~> 5.1) among 42 total gem(s) (Gem::MissingSpecError)

I am new to using React Native and is currently trying to make a simple to-do list. Unfortunately, I cannot proceed rn as I am stuck with this error, which I have no idea how to fix.
What happened?
My react native worked fine until today because of a build failure due to 'RangeError - integer 4294967288 too big to convert to `int' (https://github.com/CocoaPods/CocoaPods/issues/10651).
I accidentally did sudo rm -rf /Library/Ruby/Gems/* while trying to solve the previous issue.
Now, every time I do pod install, I get this error:
Traceback (most recent call last):
16: from /usr/local/Cellar/cocoapods/1.10.1_1/libexec/bin/pod:23:in <main>' 15: from /Library/Ruby/Site/2.6.0/rubygems.rb:301:in activate_bin_path'
14: from /Library/Ruby/Site/2.6.0/rubygems.rb:301:in synchronize' 13: from /Library/Ruby/Site/2.6.0/rubygems.rb:302:in block in activate_bin_path'
12: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1372:in activate' 11: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1390:in activate_dependencies'
10: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1390:in each' 9: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1408:in block in activate_dependencies'
8: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1372:in activate' 7: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1390:in activate_dependencies'
6: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1390:in each' 5: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1408:in block in activate_dependencies'
4: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1372:in activate' 3: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1390:in activate_dependencies'
2: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1390:in each' 1: from /Library/Ruby/Site/2.6.0/rubygems/specification.rb:1402:in block in activate_dependencies'
/Library/Ruby/Site/2.6.0/rubygems/dependency.rb:311:in to_specs': Could not find 'minitest' (~> 5.1) among 42 total gem(s) (Gem::MissingSpecError) Checked in 'GEM_PATH=/Users/XXX/.gem/ruby/2.6.0:/Library/Ruby/Gems/2.6.0:/usr/local/Cellar/cocoapods/1.10.1_1/libexec:/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/gems/2.6.0' , execute gem env` for more information
gem list:
*** LOCAL GEMS ***
abbrev (default: 0.1.0)
actioncable (6.1.4)
actionmailbox (6.1.4)
actionmailer (6.1.4)
actionpack (6.1.4)
actiontext (6.1.4)
actionview (6.1.4)
activejob (6.1.4)
activemodel (6.1.4)
activerecord (6.1.4)
activestorage (6.1.4)
activesupport (6.1.4)
base64 (default: 0.1.0)
benchmark (default: 0.1.1)
bigdecimal (default: 3.0.0)
builder (3.2.4)
bundler (2.2.24)
cgi (default: 0.2.0)
concurrent-ruby (1.1.9)
crass (1.0.6)
csv (default: 3.1.9)
date (default: 3.1.0)
dbm (default: 1.1.0)
debug (default: 0.1.0)
delegate (default: 0.2.0)
did_you_mean (default: 1.5.0)
digest (default: 3.0.0)
drb (default: 2.0.4)
english (default: 0.7.1)
erb (default: 2.2.0)
erubi (1.10.0)
etc (default: 1.2.0)
fcntl (default: 1.0.0)
ffi (1.15.3)
fiddle (default: 1.0.6)
fileutils (default: 1.5.0)
find (default: 0.1.0)
forwardable (default: 1.3.2)
getoptlong (default: 0.1.1)
globalid (0.4.2)
i18n (1.8.10)
io-console (default: 0.5.7)
io-nonblock (default: 0.1.0)
io-wait (default: 0.1.0)
ipaddr (default: 1.2.2)
irb (default: 1.3.5)
json (default: 2.5.1)
logger (default: 1.4.3)
loofah (2.10.0)
mail (2.7.1)
marcel (1.0.1)
matrix (default: 0.3.1)
method_source (1.0.0)
mini_mime (1.1.0)
minitest (5.2.0, 5.1.0)
mutex_m (default: 0.1.1)
net-ftp (default: 0.1.2)
net-http (default: 0.1.1)
net-imap (default: 0.1.1)
net-pop (default: 0.1.1)
net-protocol (default: 0.1.0)
net-smtp (default: 0.2.1)
nio4r (2.5.7)
nkf (default: 0.1.0)
nokogiri (1.11.7 x86_64-darwin)
observer (default: 0.1.1)
open-uri (default: 0.1.0)
open3 (default: 0.1.1)
openssl (default: 2.2.0)
optparse (default: 0.1.0)
ostruct (default: 0.3.1)
pathname (default: 0.1.0)
power_assert (1.2.0)
pp (default: 0.1.0)
prettyprint (default: 0.1.0)
prime (default: 0.1.2)
pstore (default: 0.1.1)
psych (default: 3.3.0)
racc (default: 1.5.1)
rack (2.2.3)
rack-test (1.1.0)
rails (6.1.4)
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.3.0)
railties (6.1.4)
rake (13.0.3)
rbs (1.0.4)
rdoc (default: 6.3.1)
readline (default: 0.0.2)
readline-ext (default: 0.1.1)
reline (default: 0.2.5)
resolv (default: 0.2.0)
resolv-replace (default: 0.1.0)
rexml (3.2.5)
rinda (default: 0.1.0)
rss (0.2.9)
rubygems-update (3.2.24)
securerandom (default: 0.1.0)
set (default: 1.0.1)
shellwords (default: 0.1.0)
singleton (default: 0.1.1)
sprockets (4.0.2)
sprockets-rails (3.2.2)
stringio (default: 3.0.0)
strscan (default: 3.0.0)
syslog (default: 0.1.0)
tempfile (default: 0.1.1)
test-unit (3.3.7)
thor (1.1.0)
time (default: 0.1.0)
timeout (default: 0.1.1)
tmpdir (default: 0.1.2)
tracer (default: 0.1.1)
tsort (default: 0.1.0)
typeprof (0.12.0)
tzinfo (2.0.4)
un (default: 0.1.0)
uri (default: 0.10.1)
weakref (default: 0.1.1)
websocket-driver (0.6.5, 0.6.3)
websocket-extensions (0.1.5)
yaml (default: 0.1.1)
zeitwerk (2.4.2)
zlib (default: 1.1.0)
What I did:
bundle install -> Gemfile not found so I did bundle init at the ios file and modified the gem file (but it didn't work)
source "https://rubygems.org" gem 'rails', '~> 6.1.4' gem 'minitest', '~> 5.1' gem 'websocket-driver', '~> 0.6.5'
Would appreciate any help to fix this issue or restart so I can use React Native again.

Error when running Cucumber test scenario in RubyMine

For full transparency, I started learning about Cucumber an hour ago. I've been following a concise tutorial on using Selenium in Ruby with Cucumber and I've had no issues until this point.
In essence, I'm trying to run a test scenario(?) but I am receiving this error:
C:\Ruby27-x64\bin\ruby.exe -EUTF-8 C:\Ruby27-x64\bin\cucumber C:/Users/kanwo/RubymineProjects/untitled/features/1.feature --format Teamcity::Cucumber::Formatter --expand --color -r features
Testing started at 7:09 am ...
wrong number of arguments (given 1, expected 2)
Error creating formatter: Teamcity::Cucumber::Formatter (ArgumentError)
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/cucumber-5.3.0/lib/cucumber/formatter/io.rb:12:in `ensure_io'
C:/Program Files/JetBrains/RubyMine 2020.3.2/plugins/ruby/rb/testing/patch/bdd/teamcity/cucumber/cucumber_4_formatter.rb:20:in `initialize'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/cucumber-5.3.0/lib/cucumber/formatter/io.rb:30:in `new'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/cucumber-5.3.0/lib/cucumber/formatter/io.rb:30:in `new'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/cucumber-5.3.0/lib/cucumber/runtime.rb:206:in `create_formatter'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/cucumber-5.3.0/lib/cucumber/runtime.rb:195:in `block in formatters'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/cucumber-5.3.0/lib/cucumber/configuration.rb:209:in `block in formatter_factories'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/cucumber-5.3.0/lib/cucumber/configuration.rb:207:in `map'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/cucumber-5.3.0/lib/cucumber/configuration.rb:207:in `formatter_factories'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/cucumber-5.3.0/lib/cucumber/runtime.rb:194:in `formatters'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/cucumber-5.3.0/lib/cucumber/runtime.rb:174:in `report'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/cucumber-5.3.0/lib/cucumber/runtime.rb:76:in `run!'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/cucumber-5.3.0/lib/cucumber/cli/main.rb:29:in `execute!'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/cucumber-5.3.0/bin/cucumber:9:in `<top (required)>'
C:/Ruby27-x64/bin/cucumber:23:in `load'
C:/Ruby27-x64/bin/cucumber:23:in `<main>'
Errors are usually pretty straight-forward but I don't feel I know enough about frameworks(? again, bare with me as I've just jumped into this) so I did some research and found that this has been an issue for a while, as per these instances:
This first link is ugly, you've been warned
2015, Instance 1
2015, Instance 2
2015, Instance 3
2018, Instance 4
2020, Instance 5
2021, Instance 6
2021, 9 days ago, Instance 7
Granted, these aren't all exactly the same error(s) as mine, but they seem to share a theme; versions.
So from my understanding, this is a conflict between versions of Cucumber, RubyMine, and TeamCity.
With that said, am I essentially out of luck here? Can I perform this in something like VSCode instead? I don't like to just dump questions into forums if I don't have to but I can't even begin to know where to start to figure this out.
Also, if it helps, this is what I was running:
Feature: Feature Name
Scenario: Logging in
Given I am on the login page
When I enter my password correctly
Then I will be logged in and provided a confirmation
and these are my local gems:
activesupport (6.1.3)
ast (2.4.2)
benchmark (default: 0.1.0)
bigdecimal (default: 2.0.0)
builder (3.2.4)
bundler (default: 2.1.4)
cgi (default: 0.1.0)
childprocess (3.0.0)
concurrent-ruby (1.1.8)
csv (default: 3.1.2)
cucumber (5.3.0)
cucumber-core (8.0.1)
cucumber-create-meta (2.0.4)
cucumber-cucumber-expressions (10.3.0)
cucumber-gherkin (15.0.2)
cucumber-html-formatter (9.0.0)
cucumber-messages (13.2.1)
cucumber-tag-expressions (2.0.4)
cucumber-wire (4.0.1)
date (default: 3.0.0)
dbm (default: 1.1.0)
delegate (default: 0.1.0)
did_you_mean (default: 1.4.0)
diff-lcs (1.4.4)
etc (default: 1.1.0)
fcntl (default: 1.0.0)
ffi (1.15.0 x64-mingw32)
fiddle (default: 1.0.0)
fileutils (default: 1.4.1)
forwardable (default: 1.3.1)
gdbm (default: 2.1.0)
getoptlong (default: 0.1.0)
i18n (1.8.9)
io-console (default: 0.5.6)
ipaddr (default: 1.2.2)
irb (default: 1.2.6)
jar_wrapper (0.1.8)
json (default: 2.3.0)
logger (default: 1.4.2)
matrix (default: 0.2.0)
middleware (0.1.0)
minitest (5.13.0)
multi_test (0.1.2)
mutex_m (default: 0.1.0)
net-pop (default: 0.1.0)
net-smtp (default: 0.1.0)
net-telnet (0.2.0)
observer (default: 0.1.0)
open3 (default: 0.1.0)
openssl (default: 2.1.2)
ostruct (default: 0.2.0)
parallel (1.20.1)
parser (3.0.0.0)
power_assert (1.1.7)
prime (default: 0.1.1)
protobuf-cucumber (3.10.8)
pstore (default: 0.1.0)
psych (default: 3.1.0)
racc (default: 1.4.16)
rainbow (3.0.0)
rake (13.0.1)
rdoc (default: 6.2.1)
readline (default: 0.0.2)
regexp_parser (2.1.1)
reline (default: 0.1.5)
rexml (default: 3.2.3)
rss (default: 0.2.8)
rubocop (1.11.0)
rubocop-ast (1.4.1)
ruby-progressbar (1.11.0)
rubyzip (2.3.0)
sdbm (default: 1.0.0)
selenium (0.2.11)
selenium-webdriver (3.142.7)
singleton (default: 0.1.0)
stringio (default: 0.1.0)
strscan (default: 1.0.3)
sys-uname (1.2.2)
test-unit (3.3.4)
thor (1.1.0)
thread_safe (0.3.6)
timeout (default: 0.1.0)
tracer (default: 0.1.0)
tzinfo (2.0.4)
unicode-display_width (2.0.0)
uri (default: 0.10.0)
webrick (default: 1.6.0)
xmlrpc (0.3.0)
yaml (default: 0.1.0)
zeitwerk (2.4.2)
zip (2.0.2)
zlib (default: 1.1.0)
Any insight is appreciated!
This is a RubyMine bug. Nothing we can fix on the Cucumber end.
You can either consult a non-recommended monkeypatch / hack. Or downgrade to an early version of Cucumber5.
See https://youtrack.jetbrains.com/issue/RUBY-27294 for more information, including other possible workarounds and a time-frame for the fix from Jetbrains.
Luke - Cucumber Ruby committer.
I faced same issue but solved by updating Run settings in RubyMine as per below steps:
Run->Edit Configurations->Templates->Cucumber->Configuration-> Runner Options as "--color -r features -f pretty"

What are the default gems of Mac OSX 10.11?

I tried to study Ruby on Rails and followed a tutorial. However, I think I missed a part and I can't proceed to the next step in the tutorial, so I plan to uninstall things, including the gems I installed, and start all over again.
I installed Ruby using Homebrew, because people say it's best not to mess with the Ruby that comes with macOS. Then, I uninstalled it again using brew uninstall ruby.
After doing that, I ran gem list and this came out:
*** LOCAL GEMS ***
- bigdecimal (1.2.0)
- builder (3.2.2)
- CFPropertyList (2.2.8)
- io-console (0.4.2)
- json (1.7.7)
- libxml-ruby (2.6.0)
- minitest (4.3.2)
- nokogiri (1.5.6)
- psych (2.0.0)
- rake (0.9.6)
- rdoc (4.0.0)
- sqlite3 (1.3.7)
- test-unit (2.0.0.0)
- thor (0.19.1)
What are the gems (if any) that come with macOS system Ruby?
My fresh El Capitan gives:
*** LOCAL GEMS ***
bigdecimal (1.2.0)
CFPropertyList (2.2.8)
io-console (0.4.2)
json (1.7.7)
libxml-ruby (2.6.0)
minitest (4.3.2)
nokogiri (1.5.6)
psych (2.0.0)
rake (0.9.6)
rdoc (4.0.0)
sqlite3 (1.3.7)
test-unit (2.0.0.0)
which is the same as #jsejcksn mentioned. For macOS 10.13.6 (High Sierra) and 10.14.5 (Mojave) the list is
*** LOCAL GEMS ***
bigdecimal (1.2.8)
CFPropertyList (2.2.8)
did_you_mean (1.0.0)
io-console (0.4.5)
json (1.8.3.1)
libxml-ruby (2.9.0)
minitest (5.8.5)
net-telnet (0.1.1)
nokogiri (1.5.6)
power_assert (0.2.6)
psych (2.1.0.1)
rake (10.4.2)
rdoc (4.2.1)
sqlite3 (1.3.11)
test-unit (3.1.5)
As addendum, for anybody else wondering what the current default Gems on macOS 10.13.3 are:
*** LOCAL GEMS ***
bigdecimal (1.2.8)
CFPropertyList (2.2.8)
did_you_mean (1.0.0)
io-console (0.4.5)
json (1.8.3)
libxml-ruby (2.9.0)
minitest (5.8.5)
net-telnet (0.1.1)
nokogiri (1.5.6)
power_assert (0.2.6)
psych (2.1.0)
rake (10.4.2)
rdoc (4.2.1)
sqlite3 (1.3.11)
test-unit (3.1.5)
Shipped gem version is 2.5.2.
macOS 12.0.1 Monterey
% gem list
*** LOCAL GEMS ***
bigdecimal (default: 1.4.1)
bundler (default: 1.17.2)
CFPropertyList (2.3.6)
cmath (default: 1.0.0)
csv (default: 3.0.9)
date (default: 2.0.0)
dbm (default: 1.0.0)
did_you_mean (1.3.0)
e2mmap (default: 0.1.0)
etc (default: 1.0.1)
fcntl (default: 1.0.0)
fiddle (default: 1.0.0)
fileutils (default: 1.1.0)
forwardable (default: 1.2.0)
io-console (default: 0.4.7)
ipaddr (default: 1.2.2)
irb (default: 1.0.0)
json (default: 2.1.0)
libxml-ruby (3.2.1)
logger (default: 1.3.0)
matrix (default: 0.1.0)
mini_portile2 (2.4.0)
minitest (5.11.3)
mutex_m (default: 0.1.0)
net-telnet (0.2.0)
nokogiri (1.10.1)
openssl (default: 2.1.2)
ostruct (default: 0.1.0)
power_assert (1.1.3)
prime (default: 0.1.0)
psych (default: 3.1.0)
rake (12.3.3)
rdoc (default: 6.1.2.1)
rexml (default: 3.1.9.1)
rss (default: 0.2.7)
scanf (default: 1.0.0)
sdbm (default: 1.0.0)
shell (default: 0.7)
sqlite3 (1.3.13)
stringio (default: 0.0.2)
strscan (default: 1.0.0)
sync (default: 0.5.0)
test-unit (3.2.9)
thwait (default: 0.1.0)
tracer (default: 0.1.0)
webrick (default: 1.4.4)
xmlrpc (0.3.0)
zlib (default: 1.0.0)
OS X 10.10 has Ruby 2.0 has the default version, so I guess 10.11 is the same.
However, I would suggest you to use Ruby 2.3.0, because it is the most current stable version.
Since you are using brew, you can use the following code:-
brew install rbenv ruby-build
# Add rbenv to bash so that it loads every time you open a terminal
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile
# Install Ruby
rbenv install 2.3.0
rbenv global 2.3.0
ruby -v
Reference: https://gorails.com/setup/osx/10.11-el-capitan
UPDATE: latest stable should be 2.3.0 instead of 2.2.3. Thanks spikermann for pointing out.

Resources