0
votes

I did a fresh install of Ubuntu 12.04 yesterday and am working with Ruby/Rails for the first time in this environment, and copied the project directly from my Windows machine. I installed rubygems, then cd'd to the project directory and ran bundle install, which worked without any errors.

When trying to start the server though (rails s) , the server never starts and I get an exception:

/usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [] (Gem::LoadError)

from /usr/lib/ruby/vendor_ruby/1.8/rubygems/dependency.rb:256:in to_spec'
from /usr/lib/ruby/vendor_ruby/1.8/rubygems.rb:1208:in
gem'
from /usr/local/bin/rails:18

My Gemfile is as folows:

source 'http://rubygems.org'

gem 'rails', '3.2.6'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'sqlite3'
gem 'execjs'
gem 'therubyracer'

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '~> 3.2.3'
  gem 'coffee-rails', '~> 3.2.1'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer', :platforms => :ruby

  gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'
gem 'devise'

# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the app server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'debugger'

Everything is for the most part what the generator left it as. Thank you.

2
Have you tried? bundle exec rails sutwang
@at2c just tried that, returns this. That also should not be :key. Not too sure why it works fine on my Windows machine.Lander
in 10th line, ...sion_store :cookie_store, key: '_threexortwo_session'. 'key: xxx' is hash in Ruby 1.9. But, in the log, I can see keyword of '1.8'. Which version do you use in both environment?utwang
I'm using 1.9.3, but I noticed when checking with rails -v I get the same error as in the question. I reinstalled 1.9.3 with RVM, reset the alias, checked with rails -v (worked), then ran sudo gem install bundler and sudo bundle install again. After this, I tried rerunning the server, and it failed again. Rain rails -v and I get the error again.Lander
What is message after rails -v at two directory? And try which rails at two directory. 1)Rails Application Root 2)Out of Rails Application (ex $home).utwang

2 Answers

2
votes

Finally got it working. For anyone who wants the full shell log, here it is: link

The issue was I believe with versions. When using RVM, you have to set terminal to run command as a login shell. Since for some reason everything needs to be run as sudo to work properly (I'm new to Linux), so I ran sudo gem install rails, then sudo bundle install, and now it seems to work.

0
votes

Maybe, this error is caused by rvm environment.

We can use particular ruby and gems in particular rails app by using rvm.

Try the following.

rvm gemset create [gemset_name]
cd ~/Documents/Programming/Web/threexortwo
rvm use ruby-1.9.3-p[XXX]@[gemset_name]
bundle install (not use sudo)
rails -v  (not use sudo)
rails s  (not use sudo)