I am having problems running the command bundle exec guard init rspec - ruby-on-rails

I am going through the railstutorial.org book.
I am receiving this error:
$ bundle exec guard init rspec
c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/guard-2.0.3/lib/guard/interactor.rb:1:in
require': cannot load such file -- pry (LoadError)
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/guard-2.0.3/lib/guard/inter
actor.rb:1:in'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/guard-2.0.3/lib/guard/dsl.r
b:2:in require'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/guard-2.0.3/lib/guard/dsl.r
b:2:in'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/guard-2.0.3/lib/guard.rb:6:
in require'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/guard-2.0.3/lib/guard.rb:6:
in'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/guard-2.0.3/bin/guard:3:in
require'
from c:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/guard-2.0.3/bin/guard:3:in
'
from c:/Ruby200-x64/bin/guard:23:in load'
from c:/Ruby200-x64/bin/guard:23:in'
My gem file is:
1. source 'https://rubygems.org'
ruby '2.0.0'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.0'
group :development, :test do
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
gem 'rspec-rails', '2.13.1'
gem 'guard-rspec', '2.0.0'
gem 'guard', '2.0.3'
end
group :test do
gem 'selenium-webdriver', '2.35.1'
gem 'capybara', '2.1.0'
gem 'rb-notifu', '0.0.4'
gem 'win32console', '1.3.2'
gem 'wdm', '0.1.0'
end
# Use SCSS for stylesheets
gem 'sass-rails', '4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '2.1.1'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks', '1.1.1'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '1.0.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '0.3.20', require: false
end
group :production do
gem 'pg', '0.15.1'
gem 'rails_12factor', '0.0.2'
end
Am I missing something? Thanks for any help!

Looks like guard requires pry be installed.
gem install pry

Explicitly add pry or similar to your Gemfile. I use pry-nav which will automatically bundle pry when bundle install is run.
# Gemfile
gem 'pry-nav', group: [:development, :test]
Cite:
http://pryrepl.org/
https://github.com/nixme/pry-nav
https://github.com/nixme/pry-debugger
https://github.com/rweng/pry-rails

Related

Why is bundler looking for mysql2 -v '0.4.4' --source 'https://rubygems.org/'

Below is my Gemfile but i haven't specified the mysql2 version but for some reason it's looking for 0.4.4. It must be a dependency of another gem. I was just assigned thAny ideas?
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use sqlite3 as the database for Active Record
gem 'mysql2', group: :production
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
gem 'active_model_serializers', '~> 0.10.0.rc5'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'acts_as_better_tree'
gem 'rest-client', '~> 1.8'
gem 'apipie-rails', :github => 'Apipie/apipie-rails'
gem 'devise'
gem 'petergate'
gem 'pry-rails'
gem 'annotate'
gem 'slim-rails'
gem 'bootstrap-sass'
gem 'font-awesome-sass'
gem 'carrierwave'
gem 'carrierwave-base64'
gem 'carrierwave-aws'
gem 'authorizenet'
gem 'figaro'
gem 'roo', '~> 2.3.2'
gem 'roo-xls', '~> 1.0'
gem 'mini_magick', '~> 4.5'
gem 'html5shiv-rails'
gem 'cocoon'
gem 'will_paginate'
gem 'wicked_pdf'
gem 'wkhtmltopdf_binary'
gem "minitest-rails"
gem "minitest-reporters"
gem 'airbrake', '~> 5.6'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'capistrano'
gem 'capistrano-passenger'
gem 'capistrano-bundler'
gem 'capistrano-rails'
gem 'capistrano-rails-console'
gem 'capistrano-rvm'
gem 'better_errors'
gem 'pry'
end
group :development, :test do
gem 'sqlite3'
gem 'byebug'
end
$ gem dependency mysql2 --reverse-dependencies
It'll list each version of mysql2 and then the gems that depend on that version.
I believe the problem is with the rails version and mysql2 version. Change the Gemfile line that contains gem 'mysql2' to gem 'mysql2', '~> 0.4.0'
I have gem 'rails', '4.2.6' installed but apparently there is some compile error with mysql2 and that version of rails.
"For Rails 4.x please pin the gem to mysql2 '~> 0.4.0'" - sodabrew
After doing this the bundle install ran and I was able to run rails c without errors.

Rails 'bundle install' fails because attempt to write to file 'is unsupported by your OS'

I'm attempting to run a rails app on my local machine developed elsewhere, but I can't get it to run locally. When I run rails s to get the server running, I get:
Could not find proper version of railties (4.2.6) in any of the sources
Run `bundle install` to install missing gems.
So, naturally, I run bundle install but get the error:
Attempting to write to
`/home/rails/apps/intranet/shared/bundle/ruby/2.2.0` is
unsupported by your OS
My OS is macOS Sierra version 10.12.4.
Also, railties is in the gem folder and seems to be the correct version.
Thanks in advance.
Edit: Adding Gemfile
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.6'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'
# Use Unicorn as the app server
gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development
gem 'devise'
gem 'rails_admin'
gem 'carrierwave'
gem 'where-or'
# Railties
gem 'railties', '~> 4.2', '>= 4.2.6'
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug'
gem 'rspec-rails'
gem 'factory_girl_rails'
gem 'pry-rails'
end
group :development do
# Access an IRB console on exception pages or by using <%= console %> in views
gem 'web-console', '~> 2.0'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'guard', require: false
gem 'guard-rspec', require: false
gem 'guard-bundler', require: false
gem "guard-cucumber", require: false
gem 'ruby_gntp'
gem 'terminal-notifier'
gem 'terminal-notifier-guard'
gem 'thin'
gem 'quiet_assets'
gem 'capistrano-rails'
gem 'capistrano-rvm'
gem 'capistrano3-unicorn'
gem 'capistrano-bundler'
gem 'better_errors'
gem 'binding_of_caller'
end
group :test do
gem 'database_cleaner'
gem 'capybara'
gem 'shoulda-matchers'
gem 'poltergeist'
gem 'launchy'
gem "cucumber-rails", require: false
end
Found out what was the issue. Since this was downloaded from a remote server, the .bundle/config file had a different path for 'BUNDLE_PATH'. I simply had to change that to the path on my own computer instead of the path on the remote server and I stopped getting the error.
check if you have write permissions to the directory /home/rails/apps/intranet/shared/bundle/ruby/2.2.0`

Cannot run puma server for my application because of bcrypt

My machine is a Windows 8 32 bit machine and I have ruby 2.1.8.
I am facing a problem when I am trying to open my app in puma and rails server. I am even unable to run bundle install. The erorr is:
in `require': 126: The specified module could not be found.
- C:/Ruby21/lib/ruby/gems/2.1.0/gems/bcrypt-ruby-3.1.1.rc1-x86-mingw32/lib/bcrypt_ext.so (LoadError)
and the bundle install error is:
could not find gem 'bcrypt (=3.1.5 rc1) x64-mingw32' in any of the gemfile ruby 2.1.8
same problem happens also for bcrypt version 3.0.0 and 3.1.1 also
My Gemfile is:
source 'http://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.9'
# Use sqlite3 as the database for Active Record
gem 'pg'
gem 'plivo'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
gem 'coffee-script-source', '1.8.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library gem 'jquery-rails'
gem 'rails-jquery-autocomplete', :git 'https://github.com/AyushRuiaHW/rails-jquery-autocomplete.git'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
gem 'tzinfo-data'
gem 'faraday'
gem 'hypdf', '~> 1.0.12'
gem 'currency-in-words'
gem "jquery-ui-rails"
gem 'Instamojo-rb'
gem "kaminari"
gem "rails-erd"
gem 'levenshtein', '~> 0.2.2'
gem "lol_dba"
gem "bullet", :group => "development"
gem "bootstrap-sass"
gem 'rack-mini-profiler'
gem 'newrelic_rpm'
gem 'puma_worker_killer'
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
gem 'postmark-rails'
gem 'bcrypt-ruby', '3.1.5.rc1', :require => 'bcrypt'
gem 'puma'
gem "paperclip", "~> 3.0"
gem 'aws-sdk', '~> 1'
gem 'aws-sdk-resources', '~> 2'
gem 'rails_12factor', group: :production
ruby "2.1.8"
delete your old gem 'bcrypt-ruby',and insert
gem 'bcrypt', '~> 3.1', '>= 3.1.11'
and run
bundle install
You need to remove your old gem and update your gemfile with following
gem 'bcrypt-ruby', '~> 3.1.0'
and run bundle install , then restart your server.
You might also want to try deleting your gemfile.lock and re-running bundle install.
OR
you can install gem bcrypt directly from command line as following :
gem install --version='3.1.0' bcrypt-ruby
then run bundle install

Issue with Rails Bundle Install

When I try to run bundle install in terminal. I receive this error message.
Gemfile syntax error on line 36: syntax error, unexpected tIDENTIFIER, expecting
keyword_end
The code in my gem file is below. I am trying to install rspec, it works perfectly fine without the last 9 lines. So the problem lies somewhere in that section, yet I'm not able to figure it out. Any guidance would be much appreciated!
source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.1.1'
# Use sqlite3 as the database for Active Record
gem 'sqlite3'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.3'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring', group: :development
source 'http://rubygems.org'
gem 'rails', '3.0.0'
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
group :development do
gem 'rspec-rails', '2.0.0'
end
group :test do
gem 'rspec', '2.0.0' gem 'webrat', '0.7.1'
end
on line 36 you have this:
group :test do
gem 'rspec', '2.0.0' gem 'webrat', '0.7.1'
end
but you should have this (you need a new line)
group :test do
gem 'rspec', '2.0.0'
gem 'webrat', '0.7.1'
end
each gem has to be on its own line

Heroku states "Specified 'sqlite3' for database adapter"

Heroku states "Specified 'sqlite3' for database adapter, but the gem is not loaded. Add gem 'sqlite3' to your Gemfile" on the inital commit.
I've already changed my Gemfile so that sqlite is used in development and pg is used in production mode. My database.yml is added to the .gitignore file. Are there any places where I have to change sqlite to pg?
Thanks in advance
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.1'
gem 'activeadmin', github: 'gregbell/active_admin'
gem 'anjlab-bootstrap-rails', :require => 'bootstrap-rails',
:github => 'anjlab/bootstrap-rails',
:branch => '3.0.0'
gem "font-awesome-rails"
gem "json"
gem "nokogiri"
gem "leaflet-rails"
gem "mapbox-rails"
# Use SCSS for stylesheets
gem 'sass-rails', '~> 4.0.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .js.coffee assets and views
gem 'coffee-rails', '~> 4.0.0'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 1.2'
group :doc do
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', require: false
end
group :production, :staging do
gem 'pg'
gem 'rails_12factor'
end
group :development do
gem 'sqlite3'
gem 'better_errors'
gem "binding_of_caller"
end
# Use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.1.2'
# Use unicorn as the app server
# gem 'unicorn'
# Use Capistrano for deployment
# gem 'capistrano', group: :development
# Use debugger
# gem 'debugger', group: [:development, :test]
I previously ran
bundle install --without production
the solution to my problem was to install also the production gems. What my production gems have to do with a "specified sqlite3 adapter" I don't understand at all.

Resources