Cannot execute rspec using bundle exec rspec - ruby

I am pretty new at programming, just learning for a few months, and I have been trying to run rspec for a ruby project I am working on so I can become more familiar with TDD and when I try to run rspec using bundle exec rspec, I get the following exception:
Traceback (most recent call last):
14: from /usr/local/bin/rspec:23:in `<main>'
13: from /usr/local/bin/rspec:23:in `load'
12: from /var/lib/gems/2.5.0/gems/rspec-core-3.2.3/exe/rspec:4:in `<top (required)>'
11: from /var/lib/gems/2.5.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:38:in `invoke'
10: from /var/lib/gems/2.5.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:70:in `run'
9: from /var/lib/gems/2.5.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:85:in `run'
8: from /var/lib/gems/2.5.0/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:96:in `setup'
7: from /var/lib/gems/2.5.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration_options.rb:22:in `configure'
6: from /var/lib/gems/2.5.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration_options.rb:109:in `process_options_into'
5: from /var/lib/gems/2.5.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration_options.rb:109:in `each'
4: from /var/lib/gems/2.5.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration_options.rb:110:in `block in process_options_into'
3: from /var/lib/gems/2.5.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1181:in `requires='
2: from /var/lib/gems/2.5.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1181:in `each'
1: from /var/lib/gems/2.5.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1181:in `block in requires='
/var/lib/gems/2.5.0/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1181:in `require': cannot load such file -- spec_helper (LoadError)
I think there may be something wrong with my PATH, as i had to install my gems using sudo command. When trying to make sure bundler was updated I got the following warning:
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Using bundler 2.1.4
Using byebug 11.1.1
Following files may not be writable, so sudo is needed:
/usr/local/bin
/var/lib/gems/2.5.0
/var/lib/gems/2.5.0/build_info
/var/lib/gems/2.5.0/cache
/var/lib/gems/2.5.0/doc
/var/lib/gems/2.5.0/extensions
/var/lib/gems/2.5.0/gems
/var/lib/gems/2.5.0/specifications
Using diff-lcs 1.3
Using rspec-support 3.2.2
Using rspec-core 3.2.3
Using rspec-expectations 3.2.1
Using rspec-mocks 3.2.1
Using rspec 3.2.0
my computer is currently running the most recent version of ubuntu and I am using VScode if that provides any help. My current PATH seems like it has many repeated instances of the same thing and I don't know if that is contributing to anything.
My current PATH:
/home/tom/.rbenv/bin:/home/tom/.rbenv/shims:/home/tom/.rbenv/bin:/home/tom/.rbenv/bin:/home/tom/.rbenv/bin:/home/tom/.rbenv/shims:/home/tom/.rbenv/bin:/home/tom/.rbenv/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
any help is greatly appreciated! I am so tired of getting hung up by this and trying to google around figuring out whats wrong hasnt been helping.

Related

Ruby: Gem dbd-pg(0.3.9) not working with Ruby 2.7

I'm trying to migrate very old script to ruby 2.7, gem seems to be installed correctly but its throwing out error i am assuming that error is because the script is expecting PG gem version to be 0.9.0 but for some reason on ruby 2.7 this is version is not getting installed and its installing 1.2.3 and dbd-pg calls pg gem so that might be causing this issue.
here is the trace:
Trace: C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/dbd-pg-0.3.9/lib/dbd/pg/database.rb:81:in `rescue in initialize'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/dbd-pg-0.3.9/lib/dbd/pg/database.rb:40:in `initialize'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/dbd-pg-0.3.9/lib/dbd/Pg.rb:157:in `new'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/dbd-pg-0.3.9/lib/dbd/Pg.rb:157:in `connect'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/dbi-0.4.4/lib/dbi/handles/driver.rb:33:in `connect'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/dbi-0.4.4/lib/dbi.rb:148:in `connect'
C:/Virtuoz/analytics/setup/setup_analytics_databases.rb:212:in `check_database_exists'
C:/Virtuoz/analytics/setup/setup_analytics_databases.rb:222:in `check_already_set_up'
C:/Virtuoz/analytics/setup/setup_analytics_databases.rb:71:in `set_up_databases'
C:/Virtuoz/analytics/setup/setup_analytics_databases.rb:404:in `block in <main>'
C:/Virtuoz/analytics/setup/setup_analytics_databases.rb:386:in `each'
C:/Virtuoz/analytics/setup/setup_analytics_databases.rb:386:in `<main>'.
PS: I never worked on Ruby so any input is welcome. This is first time we are working with ruby and we are not much familiar with the errors or call stacks.
Thanks in advance

No signature files found in META-INF. Cannot proceed (RuntimeError)

I am trying to use calabash-android to start a test sever on a phone in android studio. I am new to this and gotten this far thanks to tutorials.
I downloaded java, ruby, calabash-android, set-up environment variables, created a key store in the .calabash-settings, have a .debug-keystore file in my .android folder.
I am stuck as to what this problem is I can run bundle exec calabash-android resign app-debug.apk fine but when i do bundle exec calabash-android run app-debug.apk, I get the following error message. I am obviously missing something but i am unsure what:
C:\Users\Dell\AndroidStudioProjects\Calabash>bundle exec calabash-android build app-debug.apk
WARNING: skipped META-INF/CERT.RSA as unsafe
Traceback (most recent call last):
8: from C:/Ruby26-x64/bin/calabash-android:23:in `<main>'
7: from C:/Ruby26-x64/bin/calabash-android:23:in `load'
6: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/calabash-android-0.5.14/bin/calabash-android:76:in `<top (required)>'
5: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/calabash-android-0.5.14/bin/calabash-android-build.rb:2:in `calabash_build'
4: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/calabash-android-0.5.14/lib/calabash-android/helpers.rb:162:in `fingerprint_from_apk'
3: from C:/Ruby26-x64/lib/ruby/2.6.0/tmpdir.rb:93:in `mktmpdir'
2: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/calabash-android-0.5.14/lib/calabash-android/helpers.rb:163:in `block in fingerprint_from_apk'
1: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/calabash-android-0.5.14/lib/calabash-android/helpers.rb:163:in `chdir'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/calabash-android-0.5.14/lib/calabash-android/helpers.rb:177:in `block (2 levels) in fingerprint_from_apk': **No signature files found in META-INF. Cannot proceed. (RuntimeError)**
I encountered the same issue with latest available versions of ruby (v3.0.2p107) and calabash (v0.9.22).
I avoided the issue by using "bundle install" command and specifying a GemFile with previous versions.
# Contents of Gemfile
source "https://rubygems.org"
ruby "2.5.1"
gem 'calabash-android', '0.9.5'
gem 'cucumber'
gem 'rexml'
gem 'rubyzip', '1.2.1'
You may want to refer to similar issues raised such as https://github.com/calabash/calabash-android/issues/802

undefined method `stubs_for' for Gem::Specification:Class (NoMethodError)

these days, I have tried to build my github blog using a minimal-mistakes theme.
at the last Quick guide there are saying
bundle exec jekyll serve
results
`find_name': undefined method `stubs_for' for Gem::Specification:Class (NoMethodError)
specific
C:\Users\all7j\Documents\project\elephantoid.github.io>bundle exec jekyll serve
Traceback (most recent call last):
21: from C:/Ruby26-x64/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:55:in `require'
20: from C:/Ruby26-x64/lib/ruby/site_ruby/2.6.0/rubygems/core_ext/kernel_require.rb:55:in `require'
19: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/setup.rb:10:in `<top (required)>'
18: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:88:in `silence'
17: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/ui/shell.rb:136:in `with_level'
16: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/setup.rb:10:in `block in <top (required)>'
15: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler.rb:149:in `setup'
14: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:20:in `setup'
13: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/runtime.rb:101:in `block in definition_method'
12: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/definition.rb:226:in `requested_specs'
11: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/definition.rb:237:in `specs_for'
10: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/definition.rb:170:in `specs'
9: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/definition.rb:258:in `resolve'
8: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/definition.rb:268:in `index'
7: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/index.rb:11:in `build'
6: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/definition.rb:271:in `block in index'
5: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/definition.rb:271:in `each'
4: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/definition.rb:273:in `block (2 levels) in index'
3: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/source/metadata.rb:7:in `specs'
2: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/index.rb:11:in `build'
1: from C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/source/metadata.rb:28:in `block in specs'
C:/Ruby26-x64/lib/ruby/gems/2.6.0/gems/bundler-2.1.4/lib/bundler/rubygems_integration.rb:623:in `find_name': undefined method `stubs_for' for Gem::Specification:Class (NoMethodError)
Did you mean? stubs
I can't find what the stubs_for.
and I don't know what is the problem...
I just follow the Quick guide steps.
I had install gem, ruby, bundler on windows.
and fork GitHub, update _config.yml and more things...
I had a similar case which was brought to me through passenger.log:
[ 2020-12-07 20:13:44.4960 18738/7f0b659e8700 agents/HelperAgent/RequestHandler.h:2306 ]: [Client 19] Cannot checkout session because a spawning error occurred. The identifier of the error is e907d6aa. Please see earlier logs for details about the error.
App 19579 stdout:
App 19579 stdout:
[ 2020-12-07 20:13:54.2571 18738/7f0b67e7c700 Pool2/Implementation.cpp:287 ]: Could not spawn process for application /data/appname/current: An error occured while starting up the preloader.
Error ID: 61ed637e
Error details saved to: /tmp/passenger-error-x96ujc.html
Message from application: undefined method `stubs_for' for Gem::Specification:Class (NoMethodError)
In my case it was a rubygems version change. Depending on your application and expected version you'd like to replace it appropriately below:
gem install -v 2.7.7 rubygems-update && gem update --system 2.7.7
You may also want to uninstall previous rubygems-update prior to re-installation:
gem uninstall rubygems-update
Select gem to uninstall:
1. rubygems-update-2.4.8
2. rubygems-update-2.6.13
3. All versions
> 3
Successfully uninstalled rubygems-update-2.4.8
Remove executables:
update_rubygems
in addition to the gem? [Yn] y
Removing update_rubygems
Successfully uninstalled rubygems-update-2.6.13
and a cleanup of the corresponding folder:
rm -f /usr/local/bin/update_rubygems
You'd like to translate those to your windows machine locations/commands

How to fix Gem Conflict Error with 2 versions of a dependency without bundler

I am making a discord bot in ruby and am using the rspotify gem. rspotify has rest-client v2.0.2 as a dependency while the library discordrb has rest-client v2.1.0.rc1 as a dependency. When I try to run my code I get a Gem Conflict Error as both versions cannot be used. Is there any way to use both versions of a gem or somehow manually update rspotify to use rest-client 2.1.0.rc1?
I can upload a gem dependency list for all my gems but its pretty long. Any help would be appreciated.
Also, I am not using bundler, instead I have installed the gems manually via gem install <gem_name>.
Errors From Console:
Traceback (most recent call last):
2: from start-bot.rb:15:in `<main>'
1: from /usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- rspotify (LoadError)
5: from start-bot.rb:15:in `<main>'
4: from /usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
3: from /usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:123:in `rescue in require'
2: from /usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems.rb:217:in `try_activate'
1: from /usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems/specification.rb:1418:in `activate'
/usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems/specification.rb:2302:in `raise_if_conflicts': Unable to activate rspotify-2.6.0, because rest-client-2.1.0.rc1 conflicts with rest-client (~> 2.0.2) (Gem::ConflictError)
6: from start-bot.rb:15:in `<main>'
5: from /usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:34:in `require'
4: from /usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems/core_ext/kernel_require.rb:123:in `rescue in require'
3: from /usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems.rb:216:in `try_activate'
2: from /usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems.rb:223:in `rescue in try_activate'
1: from /usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems/specification.rb:1418:in `activate'
/usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems/specification.rb:2302:in `raise_if_conflicts': Unable to activate rspotify-2.6.0, because rest-client-2.1.0.rc1 conflicts with rest-client (~> 2.0.2) (Gem::ConflictError)

RVM after install ruby 2.5.1 got error require': cannot load such file -- bundler/setup

After install ruby 2.5.1 using RVM (lasted), when i run rails s, i got error bellow:
Traceback (most recent call last):
5: from bin/rails:3:in `<main>'
4: from bin/rails:3:in `require_relative'
3: from /Users/thiensubs/Documents/super-control/config/boot.rb:3:in `<top (required)>'
2: from /Users/thiensubs/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:39:in `require'
1: from /Users/thiensubs/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
/Users/thiensubs/.rvm/rubies/ruby-2.5.1/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:135:in `require': cannot load such file -- bundler/setup (LoadError)
Any body can help me?
You need to check your gem list and see if bundler is installed, then bundle install (--without production)
Check that you don't have a .ruby-version file with just "2.5" in it. Switching mine to "2.5.1" fixed this.
Worked for me
gem update --system

Resources