Ruby on Rails 新手,正在学习框架:-) 我正在尝试设置开发环境并在 localhost:3000 中进入欢迎页面(默认 Rails 服务器页面)。
Environment details:
(RVM managed) Ruby 2.2.2 and 2.2.3 on OSX
但仅在 Ruby 2.2.2 上尝试过。通过创建一个新的项目文件夹(没有任何特殊字符)和一个包含以下条目的 Gemfile 来安装 Rails
source 'https://rubygems.org'
gem 'rails', github:'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'rack', github: 'rack/rack'
gem 'sass-rails', github: 'rails/sass-rails'
gem 'sprockets', github: 'rails/sprockets'
gem 'sprockets-rails', '3.0.0.beta2'
bundle install命令成功(已验证 rails -v 显示Rails 5.0.0 alpha)
发布新的导轨。命令并替换了现有的 Gemfile(出现无法安装 Rails5.0.0 的错误,我猜 Rails5.0.0 不能作为 Gem 使用)所以手动更新了 Gemfile,现在如下所示
source 'https://rubygems.org'
gem 'rails', github:'rails/rails'
gem 'arel', github: 'rails/arel'
gem 'rack', github: 'rack/rack'
gem 'sass-rails', github: 'rails/sass-rails'
gem 'sprockets', github: 'rails/sprockets'
gem 'sprockets-rails', '3.0.0.beta2'
gem 'sqlite3'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.1.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jbuilder', '~> 2.0'
group :development, :test do
gem 'byebug'
end
group :development do
gem 'web-console', '~> 2.0'
gem 'spring'
end
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
发出bundle update命令并验证 rails -v 显示Rails 5.0.0 alpha。
如果我使用 rails server 启动 rails server 并点击http://localhost:3000/我会看到出现问题的错误页面并且服务器日志没有显示任何有用的消息:(
rails s
=> Booting WEBrick
=> Rails 5.0.0.alpha application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-09-15 22:20:37] INFO WEBrick 1.3.1
[2015-09-15 22:20:37] INFO ruby 2.2.2 (2015-04-13) [x86_64-darwin14]
[2015-09-15 22:20:37] INFO WEBrick::HTTPServer#start: pid=69775 port=3000
DEPRECATION WARNING: before_filter is deprecated and will be removed in Rails 5.1. Use before_action instead. (called from block (3 levels) in <class:Engine> at /Users/manikandanviswanathan/.rvm/gems/ruby-2.2.2@Rails5/gems/turbolinks-2.5.3/lib/turbolinks.rb:14)
DEPRECATION WARNING: after_filter is deprecated and will be removed in Rails 5.1. Use after_action instead. (called from block (3 levels) in <class:Engine> at /Users/manikandanviswanathan/.rvm/gems/ruby-2.2.2@Rails5/gems/turbolinks-2.5.3/lib/turbolinks.rb:15)
Started GET "/" for ::1 at 2015-09-15 22:20:39 -0700
附带说明 Rails4.2.2 在我的机器上运行良好!非常感谢任何帮助/建议。
谢谢 !