Rspec 3.0.0 Ruby on rails - ruby-on-rails

I used
gem 'rspec-rails', "~> 2.14.2" and all my tests works. Now i installed
gem 'rspec', '~> 3.0.0.beta' and I get this:
henio#henio-Toshiba:~/git/EduWords$ bundle exec rspec
/home/henio/.rvm/gems/ruby-2.1.1/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `require': cannot load such file -- rspec/rails (LoadError)
from /home/henio/.rvm/gems/ruby-2.1.1/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `block in require'
from /home/henio/.rvm/gems/ruby-2.1.1/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:214:in `load_dependency'
from /home/henio/.rvm/gems/ruby-2.1.1/gems/activesupport-4.0.3/lib/active_support/dependencies.rb:229:in `require'
from /home/henio/git/EduWords/spec/spec_helper.rb:4:in `<top (required)>'
from /home/henio/git/EduWords/spec/features/languages_pages_spec.rb:1:in `require'
from /home/henio/git/EduWords/spec/features/languages_pages_spec.rb:1:in `<top (required)>'
from /home/henio/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.rc1/lib/rspec/core/configuration.rb:1051:in `load'
from /home/henio/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.rc1/lib/rspec/core/configuration.rb:1051:in `block in load_spec_files'
from /home/henio/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.rc1/lib/rspec/core/configuration.rb:1051:in `each'
from /home/henio/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.rc1/lib/rspec/core/configuration.rb:1051:in `load_spec_files'
from /home/henio/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.rc1/lib/rspec/core/runner.rb:97:in `setup'
from /home/henio/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.rc1/lib/rspec/core/runner.rb:85:in `run'
from /home/henio/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.rc1/lib/rspec/core/runner.rb:70:in `run'
from /home/henio/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.rc1/lib/rspec/core/runner.rb:38:in `invoke'
from /home/henio/.rvm/gems/ruby-2.1.1/gems/rspec-core-3.0.0.rc1/exe/rspec:4:in `<top (required)>'
from /home/henio/.rvm/gems/ruby-2.1.1/bin/rspec:23:in `load'
from /home/henio/.rvm/gems/ruby-2.1.1/bin/rspec:23:in `<main>'
from /home/henio/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `eval'
from /home/henio/.rvm/gems/ruby-2.1.1/bin/ruby_executable_hooks:15:in `<main>'
I'm using Rails 4.0.3 and Ruby 2.1.1p76. I did bundle install. What I'm doing in wrong way?

If you’re using Rails, you should use rspec-rails to integrate Rails with RSpec. Change your gem requirement to this:
gem 'rspec-rails', '~> 3.0.0.beta'
RSpec 3 introduces significant changes, so you’ll have to update some specs.

Related

cannot load such file -- bcrypt_ext (LoadError) on windows

I have ruby 2.3.3p222 (2016-11-21 revision 56859) [x64-mingw32] and rails 5.1.4. I am getting following error when i run rails s command.
rails s
C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require': cannot load such file -- bcrypt_ext (LoadError)
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `block in require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:258:in `load_dependency'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activesupport-5.1.4/lib/active_support/dependencies.rb:292:in `require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x64-mingw32/lib/bcrypt.rb:16:in `rescue in <top (required)>'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x64-mingw32/lib/bcrypt.rb:12:in `<top (required)>'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.16.0.pre.2/lib/bundler/runtime.rb:83:in `require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.16.0.pre.2/lib/bundler/runtime.rb:83:in `block (2 levels) in require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.16.0.pre.2/lib/bundler/runtime.rb:78:in `each'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.16.0.pre.2/lib/bundler/runtime.rb:78:in `block in require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.16.0.pre.2/lib/bundler/runtime.rb:67:in `each'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.16.0.pre.2/lib/bundler/runtime.rb:67:in `require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bundler-1.16.0.pre.2/lib/bundler.rb:114:in `require'
from E:/Rauf Personal Data/work/rails/shine/config/application.rb:7:in `<top (required)>'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:133:in `require'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:133:in `block in perform'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `tap'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands/server/server_command.rb:130:in `perform'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/command.rb:27:in `run'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor/invocation.rb:126:in `invoke_command'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/thor-0.20.0/lib/thor.rb:387:in `dispatch'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command/base.rb:63:in `perform'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/command.rb:44:in `invoke'
from C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/railties-5.1.4/lib/rails/commands.rb:16:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
I have almost tried every solution but i am unable to resolve this issue. Can any body please help me to sort out this issue. I already tried following:
Firstly uninstall bcrypt and bcrypt-ruby by running these two commands:
gem uninstall bcrypt and gem uninstall bcrypt-ruby
Install it again with gem install bcrypt --platform=ruby
In your Gemfile write gem 'bcrypt-ruby', '3.1.5', :require => 'bcrypt'
Run bundle install
I have managed to solve this issue by adding following line in the Gemfile....
gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt'
After trying several methods, the above worked for me:
1) Stop all rails servers.
2) Add : gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt' to the gemfile.
3) bundle install.

Bcrypt gem in Ruby on Rails

I've just created a fresh Rails 5 application. I don't have any MVC's generated yet inside my application.
I added some gems to the gem file including gem 'bcrypt', '3.1.11'.
When I try to create a controller with the rails generator, I get an error.
This is the command with the error that I got:
command>rails generate controller StaticPages home help
C:/Ruby23/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x86-mingw32/lib/bcrypt.rb:16:in `require': cannot load such file -- bcrypt_ext (LoadError)
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x86-mingw32/lib/bcrypt.rb:16:in `rescue in <top (required)>'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x86-mingw32/lib/bcrypt.rb:12:in `<top (required)>'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `require'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `each'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:86:in `block in require'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `each'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/runtime.rb:75:in `require'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler.rb:106:in `require'
from C:/Users/Doesha/Desktop/rails17/rails_sample_app/config/application.rb:7:in `<top (required)>'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:156:in `require'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:156:in `require_application_and_environment!'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:143:in `generate_or_destroy'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:60:in `generate'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands/commands_tasks.rb:49:in `run_command!'
from C:/Ruby23/lib/ruby/gems/2.3.0/gems/railties-5.0.1/lib/rails/commands.rb:18:in `<top (required)>'
from bin/rails:4:in `require'
from bin/rails:4:in `<main>'
All I did was add gems to my gemfile, so I'm not sure why the rails generator isn't working.
I did notice that my generator stops working when I add the gem bcrypt.
Can someone tell me the reason I can't use my generator once I installed gem 'bcrypt', '3.1.11'?
delete gem 'bcrypt', '3.1.11' from gem file and
use
$gem install bcrypt

In Rubymine, Rails fails to load 'uglifier' gem

I have an issue while running Rails from Rubymine where it fails to load the uglifier gem with the stack below. Note that Node.js is installed on my Windows 7 computer.
From cmd.exe, 'rails s' works well : the web application starts.
From RubyMine run button, default configuration, I get the error :
"C:\Program Files (x86)\JetBrains\RubyMine 8.0.2\bin\runnerw.exe" C:\tools\languages\RailsInstaller\Ruby2.2.0\bin\ruby.exe -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) C:/projects/perso/exercises/bin/rails server -b 127.0.0.1 -p 3000 -e development
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
from C:/projects/perso/exercises/config/application.rb:7:in `<top (required)>'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:78:in `require'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:78:in `block in server'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `tap'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `server'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!'
from C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>'
from C:/projects/perso/exercises/bin/rails:4:in `require'
from C:/projects/perso/exercises/bin/rails:4:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
Process finished with exit code 1
I get the same error from RubyMine terminal.
Here's some information on my environment from (same output from cmd.exe and RubyMine) :
>rails --version
Rails 4.2.6
>node --version
v0.10.22
>ruby --version
ruby 2.2.4p230 (2015-12-16 revision 53155) [i386-mingw32]
Ruby was installed using Rails Installer on a Windows 7 computer.
Node.js is installed too, using official installer.
RubyMine 8.0.4 (ultimate, not sure if there's a community version too)
I suspect an environment problem inside RubyMine in which rails/bundler/gem/? can't "see" Node.js, where cmd.exe can.
I think the error started when I tryed to start RubyMine debug mode.
Any idea on how to solve the issue ?
Thanks
Edit : some more information
My Gemfile :
source 'https://rubygems.org'
gem 'rails', '4.2.6'
gem 'sqlite3'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'bcrypt', '~> 3.1.7'
group :development, :test do
gem 'byebug'
end
group :development do
gem 'web-console', '~> 2.0'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
rake tasks (for example to get the full error stack, note the ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. )
>rake tasks --trace
rake aborted!
Bundler::GemRequireError: There was an error while trying to load the gem 'uglifier'.
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
C:/projects/perso/exercises/config/application.rb:7:in `<top (required)>'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
C:/projects/perso/exercises/Rakefile:4:in `<top (required)>'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load_rakefile'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:689:in `raw_load_rakefile'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:94:in `block in load_rakefile'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:93:in `load_rakefile'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:77:in `block in run'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:75:in `run'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/bin/rake:33:in `<top (required)>'
C:/tools/languages/RailsInstaller/Ruby2.2.0/bin/rake:23:in `load'
C:/tools/languages/RailsInstaller/Ruby2.2.0/bin/rake:23:in `<main>'
ExecJS::RuntimeUnavailable: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/execjs-2.6.0/lib/execjs/runtimes.rb:48:in `autodetect'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/execjs-2.6.0/lib/execjs.rb:5:in `<module:ExecJS>'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/execjs-2.6.0/lib/execjs.rb:4:in `<top (required)>'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/uglifier-3.0.0/lib/uglifier.rb:5:in `require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/uglifier-3.0.0/lib/uglifier.rb:5:in `<top (required)>'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:77:in `block (2 levels) in require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require'
C:/projects/perso/exercises/config/application.rb:7:in `<top (required)>'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
C:/projects/perso/exercises/Rakefile:4:in `<top (required)>'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/rake_module.rb:28:in `load_rakefile'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:689:in `raw_load_rakefile'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:94:in `block in load_rakefile'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:93:in `load_rakefile'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:77:in `block in run'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:176:in `standard_exception_handling'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/lib/rake/application.rb:75:in `run'
C:/tools/languages/RailsInstaller/Ruby2.2.0/lib/ruby/gems/2.2.0/gems/rake-11.1.2/bin/rake:33:in `<top (required)>'
C:/tools/languages/RailsInstaller/Ruby2.2.0/bin/rake:23:in `load'
C:/tools/languages/RailsInstaller/Ruby2.2.0/bin/rake:23:in `<main>'
I had the same problem, though my solution isn't that simple!
I have a run configuration that has field "Environment variables" set with PATH=d:\opt\curl-7.40.0-devel-mingw64\bin\;%PATH%;=. But when I click on "..." right to this field, in value column it says d:\opt\curl-7.40.0-devel-mingw64\bin\;%PATH%" (without the "=" at the end).
I changed it so that it includes the path to node.exe
PATH=d:\opt\curl-7.40.0-devel-mingw64\bin\;d:\opt\nodejs\;%PATH%;
Now it works fine.
I run ruby 2.2.3-x64 with Rails 4.2.5 on a Windows 10 machine.
Check if your Gemfile has the following gem
gem 'uglifier'
If you already have the gem in Gemfile, then run bundle install and check if the bundle in installing the uglifier gem.
I finally got it working, here's the context and solution if someone else has the same issue.
I have defined a user scoped Path variable which was refering to my system Path as :
%Path%;C:\tools\…
In RedMine, this %Path% was not interpreted anymore (don't know why). I saw it by typing in RubyMine Terminal :
echo %Path%
The result was displaying "%Path%", not its content.
I solved the problem by simply rebooting the computer.

cannot load such file -- activerecord (LoadError)

I'm trying to upgrade a very old app from Rails 2.3.12 to Rails 3.0.0 (as a starting point to getting it to Rails 4). I've been slowly going through and fixing anything that has broken since the upgrade by removing old gems etc.
I've got stuck on a problem that I can't seem to pin point or fix.
I'm running Rails3, Ruby1.9.3
When I try to run the rails server I get the following error:
=> Booting WEBrick
=> Rails 3.0.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require': cannot load such file -- activerecord (LoadError)
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `block in require'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in `new_constants_in'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /home/camillavk/Documents/Work/Saild/saild/vendor/plugins/acts_as_commentable/lib/commentable_methods.rb:1:in `<top (required)>'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `block in require'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in `new_constants_in'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /home/camillavk/Documents/Work/Saild/saild/vendor/plugins/acts_as_commentable/lib/acts_as_commentable.rb:1:in `<top (required)>'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `block in require'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in `new_constants_in'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /home/camillavk/Documents/Work/Saild/saild/vendor/plugins/acts_as_commentable/rails/init.rb:1:in `block in <class:Plugin>'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/plugin.rb:81:in `eval'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/plugin.rb:81:in `block in <class:Plugin>'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/initializable.rb:25:in `instance_exec'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/initializable.rb:25:in `run'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/initializable.rb:50:in `block in run_initializers'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/initializable.rb:49:in `each'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/initializable.rb:49:in `run_initializers'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/application.rb:134:in `initialize!'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/application.rb:77:in `method_missing'
from /home/camillavk/Documents/Work/Saild/saild/config/environment.rb:7:in `<top (required)>'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `block in require'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in `new_constants_in'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /home/camillavk/Documents/Work/Saild/saild/config.ru:3:in `block in <main>'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rack-1.2.8/lib/rack/builder.rb:46:in `instance_eval'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rack-1.2.8/lib/rack/builder.rb:46:in `initialize'
from /home/camillavk/Documents/Work/Saild/saild/config.ru:1:in `new'
from /home/camillavk/Documents/Work/Saild/saild/config.ru:1:in `<main>'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rack-1.2.8/lib/rack/builder.rb:35:in `eval'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rack-1.2.8/lib/rack/builder.rb:35:in `parse_file'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rack-1.2.8/lib/rack/server.rb:162:in `app'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rack-1.2.8/lib/rack/server.rb:253:in `wrapped_app'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rack-1.2.8/lib/rack/server.rb:204:in `start'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/commands/server.rb:65:in `start'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/commands.rb:30:in `block in <top (required)>'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/commands.rb:27:in `tap'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/railties-3.0.0/lib/rails/commands.rb:27:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
My Gemfile looks like this:
source 'https://rubygems.org'
gem "rails", "3.0.0"
gem "airbrake"
gem "aws-s3"
gem "bj"
gem "bundler", "~> 1.0.0"
gem "calendar_date_select", "1.15"
gem "cancan", "1.2.0"
gem "carmen"
gem 'comma', '0.4.1'
gem 'exifr'
# factory_girl 1.2.4 wasn't working with Rails 3 - consider an upgrade to factory_girl_rails?
# gem "factory_girl", "1.2.4"
gem 'fastercsv'
gem "geokit"
gem "haml"
gem "hpricot"
gem 'hoptoad_notifier'
gem "jrails"
gem "libxml-ruby", "2.4.0"
gem "memcached", "~> 1.8.0"
#memcached no longer works?
gem 'dalli'
# Not sure why we have this if we're using SQLite3
gem "mysql2", "~> 0.2.6"
#TODO: changed by almazom
gem "rake", "0.8.4"
gem 'recurly'
gem "rdoc"
gem "rmagick"
gem "rspreedly"
gem "rubyzip"
gem 'sass'
#need to use simplecov when upgrading to ruby 2 as rcov doesn't work
gem "simplecov"
gem 'sqlite3'
# tmail no longer included in rails 3?
gem 'tmail'
gem "will_paginate", "2.3.16"
gem 'yaml_db'
group :development, :test do
gem 'test-unit', '1.2.3'
gem 'rspec', '1.3.2'
gem 'rspec-rails', '~> 1.3.4'
end
group :test do
gem 'capybara', '0.3.5'
gem 'cucumber', '1.1.2'
gem 'cucumber-rails', :git => "git://github.com/RKelln/cucumber-rails.git", :branch => "0.3.2-capybara-fix"
gem 'database_cleaner'
end
Has anyone else encountered this problem before when upgrading to Rails 3? I can't find anything on Google about it....
Or does anyone have a suggestion on how I can find/fix the issue?
Many thanks in advance!
Let's take a look at your stack trace. Stack traces are read top to bottom. If you have function A calling function B calling function C, where an error happens, the stack trace shows
C
B
A
We can see that the first lines all come from Rails itself:
/home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require': cannot load such file -- activerecord (LoadError)
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `block in require'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:591:in `new_constants_in'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:225:in `load_dependency'
from /home/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
Since it's usually unlikely that Rails itself is the culprit, we look for the first line that comes from some place else — either your own code, or a third-party library.
The next line is just that:
from /home/camillavk/Documents/Work/Saild/saild/vendor/plugins/acts_as_commentable/lib/commentable_methods.rb:1:in `<top (required)>'
We see that it's code at vendor/plugins, making it an old, Rails 2.3-style plugin. They were deprecated in Rails 3, and completely stopped working in Rails 4. They were replaced by "Gem plugins" that are added through your Gemfile and Bundler, instead of vendor/plugins.
So acts_as_commentable is a good candidate as the culprit. The Github project page shows a version especially for Rails 3, so removing the old plugin and replacing it with that Gem gives you a good shot at fixing this issue.

Unable to generate rspec in rails project, "uninitialized constant RSpec (NameError) is thrown"

>: rails generate rspec:install
/Users/prashanth_sams/.rvm/gems/ruby-2.0.0-p481/gems/rspec-core-3.1.7/lib/rspec/core/formatters/base_formatter.rb:1:in `<top (required)>': uninitialized constant RSpec (NameError)
from /Users/prashanth_sams/.rvm/gems/ruby-2.0.0-p481/gems/allure-rspec-0.6.7/lib/allure-rspec/formatter.rb:1:in `require'
from /Users/prashanth_sams/.rvm/gems/ruby-2.0.0-p481/gems/allure-rspec-0.6.7/lib/allure-rspec/formatter.rb:1:in `<top (required)>'
from /Users/prashanth_sams/.rvm/gems/ruby-2.0.0-p481/gems/allure-rspec-0.6.7/lib/allure-rspec.rb:3:in `require'
from /Users/prashanth_sams/.rvm/gems/ruby-2.0.0-p481/gems/allure-rspec-0.6.7/lib/allure-rspec.rb:3:in `<top (required)>'
from /Users/prashanth_sams/.rvm/gems/ruby-2.0.0-p481#global/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `require'
from /Users/prashanth_sams/.rvm/gems/ruby-2.0.0-p481#global/gems/bundler-1.6.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require'
from /Users/prashanth_sams/.rvm/gems/ruby-2.0.0-p481#global/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `each'
from /Users/prashanth_sams/.rvm/gems/ruby-2.0.0-p481#global/gems/bundler-1.6.2/lib/bundler/runtime.rb:72:in `block in require'
from /Users/prashanth_sams/.rvm/gems/ruby-2.0.0-p481#global/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `each'
from /Users/prashanth_sams/.rvm/gems/ruby-2.0.0-p481#global/gems/bundler-1.6.2/lib/bundler/runtime.rb:61:in `require'
from /Users/prashanth_sams/.rvm/gems/ruby-2.0.0-p481#global/gems/bundler-1.6.2/lib/bundler.rb:132:in `require'
from /Users/prashanth_sams/Desktop/MAC/blog/config/application.rb:7:in `<top (required)>'
from /Users/prashanth_sams/.rvm/gems/ruby-2.0.0-p481/gems/railties-3.2.16/lib/rails/commands.rb:24:in `require'
from /Users/prashanth_sams/.rvm/gems/ruby-2.0.0-p481/gems/railties-3.2.16/lib/rails/commands.rb:24:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'
I tried the below cmd in Terminal
bundle exec rails generate rspec:install
but no luck :(
Placed the below in my Gemfile
group :test, :development do
gem 'rspec-rails', '~> 3.1.0'
end
May be the version of Rspec is incompatible: downgrade the version of rspec or just write:
gem 'rspec-rails'
then you can update it:
bundle update rspec-rails
I am able to create the spec folder and spec_helper.rb using
rspec --init

Resources