Versions:
Ruby 1.9.3p194
Rails 3.2.13
Bundler 1.3.5
When I run rails new new_app, I get:
run bundle install
/var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/ui.rb:36:in `initialize': undefined method `[]' for #<Thor::Shell::Color:0x00000002b25708> (NoMethodError)
from /usr/lib/ruby/vendor_ruby/bundler/cli.rb:12:in `new'
from /usr/lib/ruby/vendor_ruby/bundler/cli.rb:12:in `initialize'
from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor.rb:263:in `new'
from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor.rb:263:in `dispatch'
from /usr/lib/ruby/vendor_ruby/bundler/vendor/thor/base.rb:386:in `start'
from /var/lib/gems/1.9.1/gems/bundler-1.3.5/bin/bundle:20:in `block in <main>'
from /var/lib/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors'
from /var/lib/gems/1.9.1/gems/bundler-1.3.5/bin/bundle:20:in `<main>'
The code in question in ui.rb is:
def initialize(options = {})
if options["no-color"] || !STDOUT.tty?
Thor::Base.shell = Thor::Shell::Basic
end
#shell = Thor::Base.shell.new
#level = ENV['DEBUG'] ? "debug" : "info"
end
I managed to fix it on my own. The post MrYoshiji linked above suggested that it was an incompatibility between Ruby and Rails. This was basically the problem - it was a version incompatibility, which is best resolved by using RVM to install a local (user-specific) copy of Ruby, Rails, etc.
But I had already installed RVM. There was a further issue that had to be resolved - RVM was not running as a function, which you can solve by setting your terminal to load /etc/profile on startup. How to do so in gnome-terminal is explained on the RVM site here.
However, this wasn't a good solution for me because it prevented my local bash files (such as ~/.bash_aliases) from loading. So instead of changing that terminal setting as shown on the RVM site, I opened ~/.bashrc and added the line source ~/.rvm/scripts/rvm. After restarting the terminal, everything was working fine - the right copies of Ruby and Rails were being used, and I was no longer encountering that error when I tried to create a new Rails app (presumably because I'm now using local copies of the gems as well, rather than a system-wide copy installed via APT).
Related
My application server is not starting and giving the error when I am trying to start the server by:
bundle exec rails server -b 0.0.0.0
Traceback (most recent call last):
4: from /root/workspace/abl-rest-client_ruby/local/ruby/2.6.0/bin/ruby_executable_hooks:24:in `<main>'
3: from /root/workspace/abl-rest-client_ruby/local/ruby/2.6.0/bin/ruby_executable_hooks:24:in `eval'
2: from /usr/local/rvm/gems/ruby-2.6.3/bin/rails:23:in `<main>'
1: from /usr/local/rvm/gems/ruby-2.6.3/gems/bundler-2.0.2/lib/bundler/rubygems_integration.rb:480:in `block in replace_bin_path'
/usr/local/rvm/gems/ruby-2.6.3/gems/bundler-2.0.2/lib/bundler/rubygems_integration.rb:460:in
`block in replace_bin_path': can't find executable rails for gem railties. railties is not
currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
I just started working on rails yesterday, so I am too new to the entire concept.
I understand the error that I am missing the railties gem but I am unable to add it.
I have tried uninstalling gems, removing gems, re-installing those, etc. as per the answers to this question 'https://stackoverflow.com/questions/9212116/rails-could-not-find-railties'
but nothing helped.
My gem list has the railties version 6.1.0 but my vendor/cache doesn't have it. I am using windows for the development and I am inside a docker container.
I don't know if not having the railties in my vendor/cache is the problem or I am missing something else.
I have already tried a couple of solutions like specifying my ruby version to rvm
rvm use -myrubyversion, re-starting bundler a couple of times, etc.
Any suggestions?
Make sure your terminal is in the root of the application and not the folder above it. That is, after you run rails new application_name_here enter cd application_name_here to get to the right folder.
I've been trying to set up ruby on rails.
I'd create a new project with
# rails new test
and I'd get this error message
Traceback (most recent call last):
6: from /usr/bin/rails:23:in `<main>'
5: from /usr/lib/ruby/2.7.0/rubygems.rb:295:in `activate_bin_path'
4: from /usr/lib/ruby/2.7.0/rubygems.rb:295:in `synchronize'
3: from /usr/lib/ruby/2.7.0/rubygems.rb:297:in `block in activate_bin_path'
2: from /usr/lib/ruby/2.7.0/rubygems.rb:230:in `finish_resolve'
1: from /usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:175:in `require'
/usr/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:175:in `ensure in require': CRITICAL: RUBYGEMS_ACTIVATION_MONITOR.owned?: before false -> after true (RuntimeError)
I have been at for quite some time and I can't find a solution.
I've also made sure everything is updated with # gem update
And sorry if this is a simple problem, I am rather new to ruby on rails. I gather it might be a problem with the monitor package?
I'm running Linux with kernel 5.6.11-arch1-1 if that helps
Not sure if this is the same problem or not, but I had a similar error (not in Rails) and this page is the first that appears in Google, so I am posting a solution if someone else happens to land here.
For me, what solved it was to run:
$ gem clean
Try reinstalling the Bundler by using
gem install bundler
Then you can run
bundle install
I'm getting this error when trying to run the gem command. Does anyone know what is causing this? It's causing me to be not able to run rails g migration commands (I get a similar error), and I'd imagine probably a lot more.
Error loading RubyGems plugin "/Users/storwell/.rvm/gems/ruby-2.0.0-p247#global/gems/executable-hooks-1.2.2/lib/rubygems_plugin.rb": undefined method `stubs' for Gem::Specification:Class (NoMethodError)
/Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:255:in `matching_specs': undefined method `stubs' for Gem::Specification:Class (NoMethodError)
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:279:in `to_specs'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/dependency.rb:309:in `to_spec'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_gem.rb:53:in `gem'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/rubygems.rb:572:in `load_yaml'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/config_file.rb:327:in `load_file'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/config_file.rb:196:in `initialize'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/gem_runner.rb:74:in `new'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/gem_runner.rb:74:in `do_configuration'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/site_ruby/2.0.0/rubygems/gem_runner.rb:39:in `run'
from /Users/storwell/.rvm/rubies/ruby-2.0.0-p247/bin/gem:21:in `<main>'
Update: I've also tried the rake command and it throws the same error.
I found an older link related to the same problem
, and it seems that it might be either a (1) Ruby installation issue, or (2) RubyGem issue. If it a Ruby issue, you need to uninstall and reinstall Ruby by using RVM (Ruby Version Manager) it seems that it worked for some. If it's (2) RubyGem issue (which it probably is), you either have to delete '/Users/storwell/.rvm/gems/ruby-2.0.0-p247#global/gems/executable-hooks-1.2.2/' folder or change the content in rubygems_plugin.rb file.
One of the users suggested (you can find from the link):
*"When I use "gem -v", the response will give me the error "Error loading RubyGems plugin "/Users/mercury/.rvm/gems/ruby-1.9.3-p194#global/gems/rubygems-bundler-0.2.8/lib/rubygems_plugin.rb": cannot load such file -- rubygems_bundler/rubygems_bundler_installer (LoadError)
So I edit "rubygems_plugins.rb", and I change the require path of rubygems_bundler, the path after modified is "./rubygems_bundler/{file_name}", and the problem solved."*
I hope these instructions + link will help you to solve the problem. I did go through the same tutorial book by Michael Hartl last summer. I think I have encountered a similar issue. I think I might have deleted one folder in order solve the issue, and perhaps reinstalled something as well (but I am not 100% because it has been a while) .
Try calling
$gem update --system
I've just created a new amazon Linux instance and installed ruby 1.9.3 and rails 3.2.8.
Upon creating a new project I immediately receive failures due to sqlite3. The error is:
[root#xxxxx fun]# rails server
/usr/local/share/gems/gems/sqlite3-1.3.6/lib/sqlite3.rb:6:in `require': cannot load such file -- sqlite3/sqlite3_native (LoadError)
from /usr/local/share/gems/gems/sqlite3-1.3.6/lib/sqlite3.rb:6:in `rescue in <top (required)>'
from /usr/local/share/gems/gems/sqlite3-1.3.6/lib/sqlite3.rb:2:in `<top (required)>'
I have confirmed that sqlite3 is working just fine outside of rails (i.e. I successfully created a database, did inserts/reads using ruby code). Here is a quick show of loading sqlite3 in irb:
irb(main):001:0> require 'sqlite3'
=> true
I'm all up to date with bundle install. sqlite3 is at version 1.3.6
I have the following packages installed:
ruby19-1.9.3.0-7.17.amzn1.i686
ruby19-devel-1.9.3.0-7.17.amzn1.i686
ruby19-irb-1.9.3.0-7.17.amzn1.noarch
ruby19-libs-1.9.3.0-7.17.amzn1.i686
rubygem19-io-console-0.3-7.17.amzn1.i686
rubygem19-rdoc-3.9.4-7.17.amzn1.i686
rubygems19-1.8.11-7.17.amzn1.noarch
sqlite-3.6.20-1.8.amzn1.i686
sqlite-devel-3.6.20-1.8.amzn1.i686
Any ideas on what I could try to get things working? Thanks!
Update
For "fun" I commented out the gem sqlite3 line from my Gemfile and tried "rails server" again. First it complained about not having a javascript runtime (which I could fix) but then it is getting the following. There seems to be something royally wrong with my install.
[root#xxxx fun]# rails server
/usr/local/share/gems/gems/railties-3.2.8/lib/rails/railtie/configuration.rb:85:in `method_missing': undefined method `active_record' for #<Rails::Application::Configuration:0x9e68f58> (NoMethodError)
from /srv/rails/fun/config/application.rb:54:in `<class:Application>'
from /srv/rails/fun/config/application.rb:13:in `<module:Fun>'
from /srv/rails/fun/config/application.rb:12:in `<top (required)>'
You may have a path problem.
To see if you have more than one version of Ruby, Rails, or gem installed:
find / | grep bin/ruby
find / | grep bin/rails
find / | grep bin/gem
On Amazon servers, I typically keep the system Ruby as is, and install my own current Ruby by using the excellent ruby-build script (better than RVM, in my opinon).
https://github.com/sstephenson/ruby-build
If you do have more than one Ruby, I suggest that you set your environment to choose one, for example by using ruby-build or by setting your PATH in your .bashrc file or /etc/environment file something like this:
PATH=/opt/ruby/1.9.1-p134/bin;$PATH
If you're using RVM, I suggest you uninstall it and change to use ruby-build.
To uninstall RVM, I use this script:
https://github.com/SixArm/sixarm_unix_shell_scripts/blob/master/rvm-uninstall-danger
I'm new to programming and am trying to set up Ruby on Rails using Michael Hartl's tutorial via Terminal on a Mac running Snow Leopard, but I'm a bit stuck on this part. I've tried using rvm 1.9.2, without any luck, and haven't been able to find anything googling. Any help would be appreciated!
Thanks!
CZom$ gem install rails -v 3.2.3
/Users/CZom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:253:in `read': Is a directory - /Users/CZom/.gemrc (Errno::EISDIR)
from /Users/CZom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:253:in `load_file'
from /Users/CZom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/config_file.rb:191:in `initialize'
from /Users/CZom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:78:in `new'
from /Users/CZom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:78:in `do_configuration'
from /Users/CZom/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/gem_runner.rb:51:in `run'
from /Users/CZom/.rvm/rubies/ruby-1.9.3-p194/bin/gem:25:in `<main>'
/Users/CZom/.gemrc should be a user specific config file that gets loaded when executing the gem command. Sounds like in your case it is a directory instead. Rubygems is complaining therefore.
Try to rename /Users/CZom/.gemrc or remove it completely if it isn't needed.