Rails 3.2.13运行rails server后出错!提示:Usage:rails new APP_PATH [options] Options:......

    今天从github上clone了一个rails项目下来准备运行它,输入:rails server

    提示:

Usage: rails new APP_PATH [options] Options: -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 -G, [--skip-git] # Skip Git ignores and keeps -m, [--template=TEMPLATE] # Path to an application template (can be a filesystem path or URL) -b, [--builder=BUILDER] # Path to a application builder (can be a filesystem path or URL) [--old-style-hash] # Force using old style hash (:foo => 'bar') on Ruby >= 1.9 [--skip-gemfile] # Don't create a Gemfile -d, [--database=DATABASE] # Preconfigure for selected database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc) # Default: sqlite3 -O, [--skip-active-record] # Skip Active Record files [--skip-bundle] # Don't run bundle install -T, [--skip-test-unit] # Skip Test::Unit files -S, [--skip-sprockets] # Skip Sprockets files -r, [--ruby=PATH] # Path to the Ruby binary of your choice # Default: /home/xichen/.rvm/rubies/ruby-1.8.7-p352/bin/ruby -j, [--javascript=JAVASCRIPT] # Preconfigure for selected JavaScript library # Default: jquery Runtime options: -q, [--quiet] # Supress status output -s, [--skip] # Skip files that already exist -f, [--force] # Overwrite files that already exist -p, [--pretend] # Run but do not make any changes 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. 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.

    后来在stackoverflow中找到了原因。由于我电脑上安装的rails版本是3.2.13,而我要运行的项目的rails版本是4.0.0,要解决这个问题,需要把自己的rails版本升级到4.0.0,或者你从你之前用3.2.13版本创建的rails项目下的script文件夹中拷贝里面的rails这个文件到你的4.0.0版本项目的script文件夹中就可以解决了!

    但是,可能会提示:

    Could not find i18n-0.6.4 in any of the sources

    Run `bundle install` to install missing gems.

    这类的问题,只要运行一下bundle install就可以了!

 

    rails项目的服务器成功运行后,进入项目主页时,又出现如下错误:

    pending fixed

    这主要是因为那个项目的rails的版本是4.0.0,你只要按照提示运行下命令:

    rake db:migrate RAILS_ENV=development

    就可以了。这时数据库会被重新创建,你需要重新加入数据。

    想更多了解,可以参考:https://github.com/rails/rails/issues/8025

 

你可能感兴趣的:(Rails)