我用RoR4构建了一个Rails应用程序,需要将其部署到运行版本3.2.13的服务器上。当尝试运行rails服务器时,我得到一个错误。如何将我的应用程序转换为在较旧版本的rails中运行?
这是我的gemfile的样子:
source 'https://rubygems.org'
gem 'rails', '4.0.2'
gem 'sqlite3'
#gem 'pg'
gem 'sass-rails' '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'jquery-rails'
gem 'turbolinks'
gem 'jquery-turbolinks'
gem 'jbuilder', '~> 1.2'
gem 'acts-as-taggable-on'
group :doc do
gem 'sdoc', require: false
end
group :development, :test do
end这是我在尝试运行rails服务器时得到的错误:
dhcp-10-156-44-120:icon-library Lewis$ rails s
Usage:
rails new APP_PATH [options]
Options:
-r, [--ruby=PATH] # Path to the Ruby binary of your choice
# Default: /Users/yudi/.rvm/rubies/ruby-2.0.0-p353/bin/ruby
-b, [--builder=BUILDER] # Path to a application builder (can be a filesystem path or URL)
-m, [--template=TEMPLATE] # Path to an application template (can be a filesystem path or URL)
[--skip-gemfile] # Don't create a Gemfile
[--skip-bundle] # Don't run bundle install
-G, [--skip-git] # Skip Git ignores and keeps
-O, [--skip-active-record] # Skip Active Record files
-S, [--skip-sprockets] # Skip Sprockets files
-d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/sqlserver/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
# Default: sqlite3
-j, [--javascript=JAVASCRIPT] # Preconfigure for selected JavaScript library
# Default: jquery
-J, [--skip-javascript] # Skip JavaScript files
[--dev] # Setup the application with Gemfile pointing to your Rails checkout
[--edge] # Setup the application with Gemfile pointing to Rails repository
-T, [--skip-test-unit] # Skip Test::Unit files
[--old-style-hash] # Force using old style hash (:foo => 'bar') on Ruby >= 1.9
Runtime options:
-f, [--force] # Overwrite files that already exist
-p, [--pretend] # Run but do not make any changes
-q, [--quiet] # Suppress status output
-s, [--skip] # Skip files that already exist
Rails options:
-h, [--help] # Show this help message and quit
-v, [--version] # Show Rails version number and quit
Description:
The 'rails new' command creates a new Rails application with a default
directory structure and configuration at the path you specify.
You can specify extra command-line arguments to be used every time
'rails new' runs in the .railsrc configuration file in your home directory.
Note that the arguments specified in the .railsrc file don't affect the
defaults values shown above in this help message.
Example:
rails new ~/Code/Ruby/weblog
This generates a skeletal Rails installation in ~/Code/Ruby/weblog.
See the README in the newly created application to get going.
dhcp-10-156-44-120:icon-library Lewis$发布于 2014-08-04 17:52:06
只是胡乱猜测,但在我看来,您的问题可能是您的服务器无法识别您的rails s命令,因为您为您的应用程序运行了错误的ruby和rails版本。
第一步是在终端中运行:
ruby -v假设您的ruby版本是1.9.3,那么上面命令的输出将是:ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-linux]
将ruby版本添加到Gemfile的顶部:
ruby "1.9.3"将所需的rails版本添加到Gemfile:
gem 'rails', '3.2.13'之后运行bundle install
在此过程中,您可能需要对rails应用程序进行更多更改,但这至少会让您的服务器识别您的应用程序。
https://stackoverflow.com/questions/22028818
复制相似问题