0

我找到了一些与我相关的帖子......但现有的答案都没有奏效......所以这是一个来自 Newbee 的新帖子:

我刚刚安装了 Ubuntu 12.10 并尝试按照各种教程(http://rubyonrails.org/download)在 Rails 上安装 Ruby,我什至尝试了 RVM ......所以最后当我尝试启动我的服务器时,我的 localhost:3000 是不工作。

这是我启动服务器时的终端:

laslo@ubuntu:~$ rails s
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': iconv will be deprecated in the future, use String#encode instead.
/usr/lib/ruby/vendor_ruby/railties/lib/rails_generator/generators/applications/app/app_generator.rb:7: Use RbConfig instead of obsolete and deprecated Config.
      exists  
      exists  app/controllers
      exists  app/helpers
      exists  app/models
      exists  app/views/layouts
      exists  config/environments
      exists  config/initializers
      exists  config/locales
      exists  db
      exists  doc
      exists  lib
      exists  lib/tasks
      exists  log
      exists  public/images
      exists  public/javascripts
      exists  public/stylesheets
      exists  script/performance
      exists  test/fixtures
      exists  test/functional
      exists  test/integration
      exists  test/performance
      exists  test/unit
      exists  vendor
      exists  vendor/plugins
      exists  tmp/sessions
      exists  tmp/sockets
      exists  tmp/cache
      exists  tmp/pids
   identical  Rakefile
   identical  README
   identical  app/controllers/application_controller.rb
   identical  app/helpers/application_helper.rb
   identical  config/database.yml
   identical  config/routes.rb
   identical  config/locales/en.yml
   identical  db/seeds.rb
   identical  config/initializers/backtrace_silencers.rb
   identical  config/initializers/inflections.rb
   identical  config/initializers/mime_types.rb
   identical  config/initializers/new_rails_defaults.rb
overwrite config/initializers/session_store.rb? (enter "h" for help) [Ynaqdh] y
       force  config/initializers/session_store.rb
overwrite config/initializers/cookie_verification_secret.rb? (enter "h" for help) [Ynaqdh] y
       force  config/initializers/cookie_verification_secret.rb
   identical  config/environment.rb
   identical  config/boot.rb
   identical  config/environments/production.rb
   identical  config/environments/development.rb
   identical  config/environments/test.rb
   identical  script/about
   identical  script/console
   identical  script/dbconsole
   identical  script/destroy
   identical  script/generate
   identical  script/runner
   identical  script/server
   identical  script/plugin
   identical  script/performance/benchmarker
   identical  script/performance/profiler
   identical  test/test_helper.rb
   identical  test/performance/browsing_test.rb
   identical  public/404.html
   identical  public/422.html
   identical  public/500.html
   identical  public/index.html
   identical  public/favicon.ico
   identical  public/robots.txt
   identical  public/images/rails.png
   identical  public/javascripts/prototype.js
   identical  public/javascripts/effects.js
   identical  public/javascripts/dragdrop.js
   identical  public/javascripts/controls.js
   identical  public/javascripts/application.js
   identical  doc/README_FOR_APP
   identical  log/server.log
   identical  log/production.log
   identical  log/development.log
   identical  log/test.log
      exists  vendor/rails

任何的想法?当然我错过了一些巨大的东西......但是什么?

4

4 回答 4

0

导轨 3+

bundle exec script/rails server从项目根目录尝试。

例如

durrantm.../linker$ bundle exec script/rails server
=> Booting WEBrick
=> Rails 3.1.8 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-04-08 21:48:24] INFO  WEBrick 1.3.1
[2013-04-08 21:48:24] INFO  ruby 1.9.3 (2012-11-10) [i686-linux]
[2013-04-08 21:48:24] INFO  WEBrick::HTTPServer#start: pid=9187 port=3000

导轨 2

从项目根目录:

$ script/server
=> Booting WEBrick
=> Rails 2.3.8 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2013-04-08 21:58:11] INFO  WEBrick 1.3.1
[2013-04-08 21:58:11] INFO  ruby 1.9.3 (2012-11-10) [i686-linux]
[2013-04-08 21:58:11] INFO  WEBrick::HTTPServer#start: pid=10473 port=3000

如果失败,也许可以重新开始:

cd                  # Go to your home directory
rails new abc       # Create the app
cd abc              # cd into the project's directory.
                    # Change the config/database.yml if desired.
script/rails server # for rails 3 or use the rails 2 command above.

更多版本信息:

Ruby,您应该使用 1.9.2+ 大多数人现在使用 1.9.3+。
我建议您使用 RVM 来维护您的 ruby​​ 版本。其他人也使用 rbenv。

rvm: https://rvm.io/ # 是的,这是一个真实的 URL!
rbenv:https ://github.com/sstephenson/rbenv/

Rails 你应该在 rails 3.1+ 检查rails -v
你可以安装一个较新的版本,并gem install rails使用-v 3.1.2来指定那个版本。

于 2013-04-09T01:47:55.790 回答
0

Rails 服务器适用于特定的应用程序。您在根路径中启动了 rails sever,当然这不起作用。

您首先需要创建一个新应用程序。

$ rails new myapp
$ cd myapp
# Install the gems needed at first
$ bundle install
# Then start server
$ rails s

添加

从您的代码中,我发现真正的原因是您使用的是 Ruby 1.9.1。您刚刚下载的最新 Rails 不支持此版本。

尝试至少将 Ruby 升级到 1.9.3。

于 2013-04-09T01:51:54.403 回答
0

你的 Ruby 版本是什么?Ruby-v显示它?你应该首先执行这些命令。

bundle update
bundle install
于 2013-04-09T01:54:21.070 回答
0

我和你有同样的问题,这就是我解决这个问题的方法。在您创建的项目的 cd 中键入script/server 。一世

于 2013-05-04T04:48:16.640 回答