简体   繁体   中英

Error when start Rails server in ubuntu

I am unable to start Rails server on ubuntu. I am Begineer on Ruby on Rails, please help me.

The error is like this:

ranjeet@ranjeet:~/Rails/rails001$ rails server
/usr/local/lib/site_ruby/1.9.1/rubygems/dependency.rb:315:in `to_specs': Could not find 'railties' (>= 0) among 0 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/home/ranjeet/.gem/ruby/1.9.1:/usr/lib/ruby/gems/1.9.1', execute `gem env` for more information
    from /usr/local/lib/site_ruby/1.9.1/rubygems/dependency.rb:324:in `to_spec'
    from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_gem.rb:64:in `gem'
    from /usr/local/bin/rails:22:in `<main>'

Look up "bundler" and install it if you don't already have it. Then run bundle install in the root directory of your application.

The reason your application does not load is beacuse one or more of the dependencies are not installed. You have these listed in your "Gemfile". Bundler is a handy program that keeps track of your installed gems for a project. You could install each separately, but then you would have to work out all the dependency conflicts on your own, one by one and keep track of all the versions you need yourself. You don't need the headache, so use bundler.

Start by looking at this error:

Could not find 'railties' (>= 0) among 0 total gem(s) (Gem::LoadError)

There are two 2 big hints here "couldn't find railties" and "among 0 total gems." I makes me think that the Gemfile is incomplete or not bundled (compiled). Here is something to try.

  1. Make sure this is the first line in your Gemfile
source 'https://rubygems.org'

2- Run bundle install on your production server. Are there errors when you do?

$bundle install

3- If you have done these and still have an error, please post it. It is possible there is a setup / directory problem.

Let me know how this goes and I can add/revise my answer based on results.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM