I wanted to generate a new migration for a site running Rails 2.3.14 and Ruby 1.8.7. I wrote the command
ruby script/generate migration AssetTable
Expecting the script to generate a file 20130522161112_asset_table.rb in the db/migrate directory. But I don't see this file. The output I get after running the above command is:
/var/lib/gems/1.8/gems/rails-2.3.14/lib/rails/gem_dependency.rb:81:in `add_load_paths': undefined method `requirement' for #<Rails::GemDependency:0x7ffd183eba58> (NoMethodError)
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:301:in `add_gem_load_paths'
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:301:in `each'
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:301:in `add_gem_load_paths'
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:132:in `process'
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:113:in `send'
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/initializer.rb:113:in `run'
from /var/www/pbcore/releases/20120416101734/config/environment.rb:17
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /var/lib/gems/1.8/gems/rails-2.3.14/lib/commands/generate.rb:1
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /usr/lib/ruby/1.8/rubygems/custom_require.rb:31:in `require
Does anyone know what I'm doing wrong here?
Depending on your rubygems versions, can you try to run:
$ gem install rubygems-update -v='1.4.2'
$ gem uninstall rubygems-update -v='1.5.0'
$ update_rubygems
Seen here: Gem dependency error in rails 2.3.4 :
This is happening because you installed RubyGems that is too new for
your version of Rails. Either downgrade (and re-run update_rubygems)
or upgrade Rails to 2.3.11.
Related
I am trying to learn rails by following the tutorial here. However when I got to the section on creating the model and ran this command:
bin/rails generate model Article title:string text:text
I got this error:
/usr/lib/ruby/vendor_ruby/spring/application.rb:152:in `serve': undefined method `cleanup!' for ActionDispatch::Reloader:Class (NoMethodError)
from /usr/lib/ruby/vendor_ruby/spring/application.rb:131:in `block in run'
from /usr/lib/ruby/vendor_ruby/spring/application.rb:125:in `loop'
from /usr/lib/ruby/vendor_ruby/spring/application.rb:125:in `run'
from /usr/lib/ruby/vendor_ruby/spring/application/boot.rb:18:in `<top (required)>'
from /usr/local/lib/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/lib/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from -e:1:in `<main>'
This is my second go through so I know I have followed all the steps. Any idea where I might look for the solution or know what the solution is?
This really has me stuck.
Versions:
Ubuntu 16.04
ruby 2.3.1p112 (2016-04-26) [x86_64-linux-gnu]
gem 2.6.12
rails 5.1.0
Based on this issue, can you run spring stop and try to run your command again?
Restarting worked for me too, but I needed to do it every-time. Instead, I upgraded to to the latest version of spring (2.0.2) in my gemfile. This fixed it.
I am trying to configure the passenger and Nginx for rails application .
I am getting compilation error while execute the passenger command.
Ruby version :
ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-linux]
Rails version
Rails 4.2.6
Error message:-
# passenger-install-nginx-module
/usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/specification.rb:2158:in `method_missing': undefined method `this' for #<Gem::Specification:0x7cab3c passenger-5.0.28> (NoMethodError)
from /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/specification.rb:1057:in `find_active_stub_by_path'
from /usr/local/rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:64:in `require'
from /usr/local/rvm/gems/ruby-2.3.1/gems/passenger-5.0.28/bin/passenger-install-nginx-module:33:in `<top (required)>'
from /usr/local/rvm/gems/ruby-2.3.1/bin/passenger-install-nginx-module:23:in `load'
from /usr/local/rvm/gems/ruby-2.3.1/bin/passenger-install-nginx-module:23:in `<main>'
from /usr/local/rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `eval'
from /usr/local/rvm/gems/ruby-2.3.1/bin/ruby_executable_hooks:15:in `<main>'
could you please help me on this matter.
If not resolved yet, you can try:
gem update --system
and then try to compile again.
This works in my case:
Remove ruby and rvm - then Reinstall. Try again.
I have a problem.
When I'm trying to generate something via rails g/rails generate controller/model/etc I got this message as an output in my terminal.
What I am doing wrong?
user#vps:/var/www/dap$ rails -v
Warning: Running `gem pristine --all` to regenerate your installed gemspecs (and deleting then reinstalling your bundle if you use bundle --path) will improve the startup performance of Spring.
Rails 4.2.0
user#vps:/var/www/dap$ ruby -v
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
user#vps:/var/www/dap$ ruby script/generate controller StaticPages home help about ruby: No such file or directory -- script/generate (LoadError)
user#vps:/var/www/dap$ bin/rails generate controller StaticPages home help about
Warning: Running `gem pristine --all` to regenerate your installed gemspecs (and deleting then reinstalling your bundle if you use bundle --path) will improve the startup performance of Spring.
^C/var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/client/run.rb:99:in `gets': Interrupt
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/client/run.rb:99:in `verify_server_version'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/client/run.rb:56:in `run'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/client/run.rb:37:in `warm_run'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/client/run.rb:26:in `call'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/client/command.rb:7:in `call'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/client/rails.rb:23:in `call'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/client/command.rb:7:in `call'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/client.rb:26:in `run'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/bin/spring:48:in `<top (required)>'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/binstub.rb:11:in `load'
from /var/lib/gems/1.9.1/gems/spring-1.3.3/lib/spring/binstub.rb:11:in `<top (required)>'
from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:54:in `require'
from /var/www/dap/bin/spring:13:in `<top (required)>'
from bin/rails:3:in `load'
from bin/rails:3:in `<main>'
P.S. Added ruby and rails versions, just in a case.
Rails 4.2 requires ruby version at least 1.9.3. Prefers 2.0+
Don't use outdated version.
Also, is look like you are using system ruby. Don`t use it. Stick to rbenv or RVM
I'm installing gitorious on my webserver. Everything works fine except git-deamon, I get the following error when I run it
/etc/init.d/git-daemon start
Starting git-daemon: /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:31:in `setup':
You have already activated daemons 1.1.4, but your Gemfile requires daemons 1.1.0.
Consider using bundle exec. (Gem::LoadError)
from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.18/lib/bundler/runtime.rb:17:in `setup'
from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.18/lib/bundler.rb:107:in `setup'
from /var/www/gitorious/script/../config/../config/preinitializer.rb:16
from /var/www/gitorious/script/../config/boot.rb:28:in `load'
from /var/www/gitorious/script/../config/boot.rb:28:in `preinitialize'
from /var/www/gitorious/script/../config/boot.rb:10:in `boot!'
from /var/www/gitorious/script/../config/boot.rb:123
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
from /var/www/gitorious/script/../config/environment.rb:11
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
from /var/www/gitorious/script/git-daemon:11
failure
I have installed enterprise ruby 1.8.7 and ruby gems 1.4.2. I'm running ubuntu 11.04.
How could i solve it?
Thanks
The easy way (but not very future-proof):
gem uninstall daemons
cd /var/www/gitorious
bundle install
The hard way: modify /etc/init.d/git-daemon so that it runs cd /var/www/gitorious && bundle exec /var/www/gitorious/script/git-daemon start
I try to run a working rails project from OSX to Debian. I use on both systems RVM and created the same gemsets and rvmrc for the project. On Debian I installed only ruby with rvm no system installation of ruby exists.
when I jump in the project folder rvm is switching to version 1.8.7 and is using the project gemset everything looks fine.
But when I fire up a rake -T I get this error:
$ rake -T --trace
(in /home/i/project/src)
rake aborted!
uninitialized constant ActiveSupport::Dependencies::Mutex
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rake-0.8.7/lib/rake.rb:2503:in `const_missing'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/activesupport-2.3.5/lib/active_support/dependencies.rb:55
/home/i/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/home/i/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/activesupport-2.3.5/lib/active_support.rb:56
/home/i/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/home/i/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rails-2.3.5/lib/tasks/misc.rake:18
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rails-2.3.5/lib/tasks/rails.rb:4:in `load'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rails-2.3.5/lib/tasks/rails.rb:4
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rails-2.3.5/lib/tasks/rails.rb:4:in `each'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rails-2.3.5/lib/tasks/rails.rb:4
/home/i/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/home/i/.rvm/rubies/ruby-1.8.7-p249/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
/home/i/ws/project/src/Rakefile:10
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rake-0.8.7/lib/rake.rb:2383:in `load'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rake-0.8.7/lib/rake.rb:2383:in `raw_load_rakefile'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rake-0.8.7/lib/rake.rb:2017:in `load_rakefile'
/ home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rake-0.8.7/lib/rake.rb:2016:in `load_rakefile'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rake-0.8.7/lib/rake.rb:2000:in `run'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/gems/rake-0.8.7/bin/rake:31
/home/i/.rvm/gems/ruby-1.8.7-p249#project/bin/rake:19:in `load'
/home/i/.rvm/gems/ruby-1.8.7-p249#project/bin/rake:19
For me, adding require 'thread' didn't work either.
The problem was solved by downgrading rubygems to 1.4.2:
It's a compatibility issue between newer versions of rubygems (in my case, 1.8.5) and old versions of rails (in my case 2.3.5)
$ gem install rubygems-update -v='1.4.2'
$ gem uninstall rubygems-update -v='1.8.5'
$ update_rubygems
My working solution. Add the following line:
require 'thread'
At the first line of Rakefile in your rails project root. And magically all will run ;-)
I ran into this myself not too long ago. If you google for it you'll find a couple of blog and mailing list posts advising you to explicitly require "threads" in your environment.rb. However this did not work for me, but downgrading rubygems did:
sudo gem update --system 1.3.7
Some of the posts also mention upgrading to a newer version of Rails, which was not an option in our case at the moment.
you can solve it by upgrading rails
gem install rails --version 2.3.11
or downgrade gem
sudo gem update --system 1.5.3