【问题标题】:"rails server" not seeing rails project locally which works fine on heroku“rails server”在本地看不到rails项目,这在heroku上运行良好
【发布时间】:2016-02-17 00:52:12
【问题描述】:

我是 Rails 新手,刚刚在 heroku 中创建了简单的“空”应用程序,并将其与我的 Dropbox 帐户同步。我能够在网络浏览器中打开 heroku 网站,然后我更改了 index.rb 并部署了应用程序,并且更改正确完成,我在网络浏览器中看到了结果。

所以保管箱文件夹中的应用程序可以正常工作,但我无法在本地运行它。当我在项目文件夹中键入 rails server 时,它只是无法识别该项目并给了我:

C:\Users\Dav\Dropbox\Apps\Heroku\aqueous-waters-4632>rails server
DL is deprecated, please use Fiddle
Usage:
  rails new APP_PATH [options]

Options:
  -r, [--ruby=PATH]                                      # Path to the Ruby bina
ry of your choice
                                                         # Default: C:/RailsInst
aller/Ruby2.0.0/bin/ruby.exe
  -m, [--template=TEMPLATE]                              # Path to some applicat
ion template (can be a filesystem path or URL)
      [--skip-gemfile], [--no-skip-gemfile]              # Don't create a Gemfil
e
  -B, [--skip-bundle], [--no-skip-bundle]                # Don't run bundle inst
all
  -G, [--skip-git], [--no-skip-git]                      # Skip .gitignore file
      [--skip-keeps], [--no-skip-keeps]                  # Skip source control .
keep files
  -O, [--skip-active-record], [--no-skip-active-record]  # Skip Active Record fi
les
  -V, [--skip-action-view], [--no-skip-action-view]      # Skip Action View file
s
  -S, [--skip-sprockets], [--no-skip-sprockets]          # Skip Sprockets files
      [--skip-spring], [--no-skip-spring]                # Don't install Spring
application preloader
  -d, [--database=DATABASE]                              # Preconfigure for sele
cted database (options: mysql/oracle/postgresql/sqlite3/frontbase/ibm_db/sqlserv
er/jdbcmysql/jdbcsqlite3/jdbcpostgresql/jdbc)
                                                         # Default: sqlite3
  -j, [--javascript=JAVASCRIPT]                          # Preconfigure for sele
cted JavaScript library
                                                         # Default: jquery
  -J, [--skip-javascript], [--no-skip-javascript]        # Skip JavaScript files

      [--dev], [--no-dev]                                # Setup the application
 with Gemfile pointing to your Rails checkout
      [--edge], [--no-edge]                              # Setup the application
 with Gemfile pointing to Rails repository
  -T, [--skip-test-unit], [--no-skip-test-unit]          # Skip Test::Unit files

      [--rc=RC]                                          # Path to file containi
ng extra configuration options for rails command
      [--no-rc], [--no-no-rc]                            # Skip loading of extra
 configuration options from .railsrc file

Runtime options:
  -f, [--force]                    # Overwrite files that already exist
  -p, [--pretend], [--no-pretend]  # Run but do not make any changes
  -q, [--quiet], [--no-quiet]      # Suppress status output
  -s, [--skip], [--no-skip]        # Skip files that already exist

Rails options:
  -h, [--help], [--no-help]        # Show this help message and quit
  -v, [--version], [--no-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.

这些是我的 Ruby 和 Rails 版本(Ruby 2.0 和 Rails 4.1.8):

C:\Users\Dav\Dropbox\Apps\Heroku\aqueous-waters-4632>ruby -v
ruby 2.0.0p598 (2014-11-13) [i386-mingw32]

C:\Users\Dav\Dropbox\Apps\Heroku\aqueous-waters-4632>rails -v
DL is deprecated, please use Fiddle
Rails 4.1.8

C:\Users\Dav\Dropbox\Apps\Heroku\aqueous-waters-4632>gem list

*** LOCAL GEMS ***

bundler (1.11.2)
jar-dependencies (0.1.15)
jruby-openssl (0.9.7 java)
jruby-win32ole (0.8.5)
json (1.8.0 java)
minitest (5.4.1)
power_assert (0.2.3)
psych (2.0.14.pre1 java)
rake (10.1.0)
rdoc (4.1.0)
ruby-maven (3.3.3)
ruby-maven-libs (3.3.3)
test-unit (3.0.3)

最后这是 heroku 构建日志供参考(Ruby 2.2.2 和 Rails 4.1.8):

-----> Using set buildpack heroku/ruby

-----> Ruby app detected

-----> Compiling Ruby/Rails

-----> Using Ruby version: ruby-2.2.2-jruby-9.0.0.0

-----> Installing JVM: openjdk-8

-----> Installing dependencies using bundler 1.9.7

       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment

       Using json 1.8.1

       Using minitest 5.4.3

       Using thread_safe 0.3.4

       Using builder 3.2.2

       Using erubis 2.7.0

       Using rake 10.4.0

       Using rack 1.5.2

       Using i18n 0.6.11

       Using mime-types 2.4.3

       Using arel 5.0.1.20140414130214

       Using coffee-script-source 1.8.0

       Using jdbc-postgres 9.3.1102

       Using execjs 2.2.2

       Using thor 0.19.1

       Using hike 1.2.3

       Using multi_json 1.10.1

       Using bundler 1.9.7

       Using tilt 1.4.1

       Using rails_serve_static_assets 0.0.2

       Using rails_stdout_logging 0.0.3

       Using sass 3.2.19

       Using tzinfo 1.2.2

       Using rdoc 4.1.2

       Using mail 2.6.3

       Using rack-test 0.6.2

       Using puma 2.9.1

       Using coffee-script 2.3.0

       Using uglifier 2.5.3

       Using rails_12factor 0.0.3

       Using sprockets 2.12.3

       Using activesupport 4.1.8

       Using tzinfo-data 1.2015.1

       Using sdoc 0.4.1

       Using actionview 4.1.8

       Using activemodel 4.1.8

       Using jbuilder 2.2.5

       Using actionpack 4.1.8

       Using activerecord 4.1.8

       Using actionmailer 4.1.8

       Using sprockets-rails 2.2.2

       Using railties 4.1.8

       Using activerecord-jdbc-adapter 1.3.14

       Using activerecord-jdbcpostgresql-adapter 1.3.14

       Using coffee-rails 4.0.1

       Using jquery-rails 3.1.2

       Using rails 4.1.8

       Using sass-rails 4.0.5

       Using turbolinks 2.5.2

       Bundle complete! 13 Gemfile dependencies, 48 gems now installed.

       Gems in the groups development and test were not installed.

       Bundled gems are installed into ./vendor/bundle.

       Bundle completed (8.97s)

       Cleaning up the bundler cache.

-----> Preparing app for Rails asset pipeline

       Running: rake assets:precompile

       Asset precompilation completed (13.25s)

       Cleaning assets

       Running: rake assets:clean

-----> Discovering process types

       Procfile declares types     -> web

       Default types for buildpack -> console, rake, worker

-----> Compressing...

       Done: 101.5M

-----> Launching...

       Released v8

【问题讨论】:

  • 尝试运行bundle install,然后运行rails server
  • 你可以试试bundle exec rails sbin\rails s
  • 感谢您的回复,但这些都不起作用

标签: ruby-on-rails ruby heroku


【解决方案1】:

尝试运行bundle install 来安装您的gem,转到db/migrate 并运行rake db:migrate,然后运行rails s

【讨论】:

  • 我正在获取 C:\Users\Dav\Dropbox\Apps\Heroku\aqueous-waters-4632\db\migrate>rake db:migrate(在 C:/Users/Dav/Dropbox/Apps /Heroku/aqueous-waters-4632) 耙子中止! ActiveRecord::JDBCError: org.postgresql.util.PSQLException: 连接被拒绝。检查主机名和端口是否正确以及 postmaster 是否接受 TCP/IP 连接。 arjdbc/jdbc/RubyJdbcConnection.java:453:in init_connection' c:\jruby-9.0.0.0\bin\rake:23:in ' 任务:TOP => db:migrate(通过使用 --trace 运行任务查看完整跟踪)
  • 您的某个控制器中有类似validate_presence_of :something 的行吗?
  • 不,项目中没有这种东西
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-01-01
  • 2013-09-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-11-13
  • 2012-09-26
相关资源
最近更新 更多