耙子流产了! LoadError:没有要加载的文件 - active_record / connection_adapters / postgresql / explain_pretty_printer

时间:2018-03-22 19:18:34

标签: ruby-on-rails ruby postgresql heroku activerecord

我已经开始学习Ruby on Rails,并且我已经学习了很多指南,因此我使用了许多版本的Ruby,我的Windows 7 64位机器。目前我安装了Ruby 2.3,我也用于入门指南Getting started with Rails。让Heroku成为我的生产之源。我已经完成了Getting started on Heroku with Ruby(Windows) 这也让我安装了JRuby 9.1.8。我在指南后取得了巨大的成功。我可以在本地和Heroku上测试我的应用程序。 在使用文档的同时,我想在这里用Aptana v3做一个真实的东西并创建一个将部署在Heroku上的应用程序,我需要运行我的PostgreSQL服务器,我安装了企业版9.3。我测试了它,我工作正常。 现在我应该能够为heroku创建我的第一个项目,我找到了Using Rails, Aptana, PostgreSQL, and Heroku Seamlessly的另一个指南 在我试图创建postgres数据库的过程中遇到的问题。 我决定概述为使事情清楚而采取的所有步骤。

当我运行此命令时:) rails new readlyme-test-perfect -d postgresql 我得到了以下输出:

Expected string default value for '--rc'; got false (boolean)
  create
  create  README.rdoc
  create  Rakefile
  create  config.ru
  create  .gitignore
  create  Gemfile
  create  app
  create  app/assets/javascripts/application.js
  create  app/assets/stylesheets/application.css
  create  app/controllers/application_controller.rb
  create  app/helpers/application_helper.rb
  create  app/views/layouts/application.html.erb
  create  app/assets/images/.keep
  create  app/mailers/.keep
  create  app/models/.keep
  create  app/controllers/concerns/.keep
  create  app/models/concerns/.keep
  create  bin
  create  bin/bundle
  create  bin/rails
  create  bin/rake
  create  bin/setup
  create  config
  create  config/routes.rb
  create  config/application.rb
  create  config/environment.rb
  create  config/secrets.yml
  create  config/environments
  create  config/environments/development.rb
  create  config/environments/production.rb
  create  config/environments/test.rb
  create  config/initializers
  create  config/initializers/assets.rb
  create  config/initializers/backtrace_silencers.rb
  create  config/initializers/cookies_serializer.rb
  create  config/initializers/filter_parameter_logging.rb
  create  config/initializers/inflections.rb
  create  config/initializers/mime_types.rb
  create  config/initializers/session_store.rb
  create  config/initializers/wrap_parameters.rb
  create  config/locales
  create  config/locales/en.yml
  create  config/boot.rb
  create  config/database.yml
  create  db
  create  db/seeds.rb
  create  lib
  create  lib/tasks
  create  lib/tasks/.keep
  create  lib/assets
  create  lib/assets/.keep
  create  log
  create  log/.keep
  create  public
  create  public/404.html
  create  public/422.html
  create  public/500.html
  create  public/favicon.ico
  create  public/robots.txt
  create  test/fixtures
  create  test/fixtures/.keep
  create  test/controllers
  create  test/controllers/.keep
  create  test/mailers
  create  test/mailers/.keep
  create  test/models
  create  test/models/.keep
  create  test/helpers
  create  test/helpers/.keep
  create  test/integration
  create  test/integration/.keep
  create  test/test_helper.rb
  create  tmp/cache
  create  tmp/cache/assets
  create  vendor/assets/javascripts
  create  vendor/assets/javascripts/.keep
  create  vendor/assets/stylesheets
  create  vendor/assets/stylesheets/.keep
     run  bundle install

  Fetching gem metadata from https://rubygems.org/...........
  Fetching gem metadata from https://rubygems.org/..

  Resolving dependencies...............................................................................................

  Fetching rake 12.3.1
  Installing rake 12.3.1
  Fetching concurrent-ruby 1.0.5 (java)
  Installing concurrent-ruby 1.0.5 (java)
  Fetching i18n 0.9.5
  Installing i18n 0.9.5
  Using json 1.8.6 (java)
  Fetching minitest 5.11.3
  Installing minitest 5.11.3
  Using thread_safe 0.3.6 (java)
  Fetching tzinfo 1.2.5
  Installing tzinfo 1.2.5
  Using activesupport 4.2.4
  Using builder 3.2.3
  Using erubis 2.7.0
  Fetching nokogiri 1.8.2 (java)
  Installing nokogiri 1.8.2 (java)
  Using rails-deprecated_sanitizer 1.0.3
  Fetching rails-dom-testing 1.0.9
  Installing rails-dom-testing 1.0.9
  Fetching crass 1.0.3
  Installing crass 1.0.3
  Fetching loofah 2.2.1
  Installing loofah 2.2.1
  Using rails-html-sanitizer 1.0.3
  Using actionview 4.2.4
  Fetching rack 1.6.9
  Installing rack 1.6.9
  Using rack-test 0.6.3
  Using actionpack 4.2.4
  Fetching globalid 0.4.1
  Installing globalid 0.4.1
  Using activejob 4.2.4
  Fetching mini_mime 1.0.0
  Installing mini_mime 1.0.0
  Fetching mail 2.7.0
  Installing mail 2.7.0
  Using actionmailer 4.2.4
  Using activemodel 4.2.4
  Using arel 6.0.4
  Using activerecord 4.2.4
  Fetching activerecord-jdbc-adapter 50.0
  Installing activerecord-jdbc-adapter 50.0
  Fetching jdbc-postgres 42.1.4
  Installing jdbc-postgres 42.1.4
  Fetching activerecord-jdbcpostgresql-adapter 50.0
  Installing activerecord-jdbcpostgresql-adapter 50.0
  Using bundler 1.16.1
  Using coffee-script-source 1.12.2
  Using execjs 2.7.0
  Using coffee-script 2.4.1
  Fetching thor 0.20.0
  Installing thor 0.20.0
  Using railties 4.2.4
  Fetching coffee-rails 4.1.1
  Installing coffee-rails 4.1.1
  Fetching ffi 1.9.23 (java)
  Installing ffi 1.9.23 (java)
  Fetching multi_json 1.13.1
  Installing multi_json 1.13.1
  Fetching jbuilder 2.7.0
  Installing jbuilder 2.7.0
  Using jquery-rails 4.3.1
  Fetching sprockets 3.7.1
  Installing sprockets 3.7.1
  Fetching sprockets-rails 3.2.1
  Installing sprockets-rails 3.2.1
  Using rails 4.2.4
  Fetching rb-fsevent 0.10.3
  Installing rb-fsevent 0.10.3
  Fetching rb-inotify 0.9.10
  Installing rb-inotify 0.9.10
  Using rdoc 4.3.0
  Fetching sass-listen 4.0.0
  Installing sass-listen 4.0.0
  Fetching sass 3.5.5
  Installing sass 3.5.5
  Fetching tilt 2.0.8
  Installing tilt 2.0.8
  Fetching sass-rails 5.0.7
  Installing sass-rails 5.0.7
  Using sdoc 0.4.2
  Fetching therubyrhino_jar 1.7.6
  Installing therubyrhino_jar 1.7.6
  Fetching therubyrhino 2.0.4
  Installing therubyrhino 2.0.4
  Fetching turbolinks-source 5.1.0
  Installing turbolinks-source 5.1.0
  Fetching turbolinks 5.1.0
  Installing turbolinks 5.1.0
  Fetching tzinfo-data 1.2018.3
  Installing tzinfo-data 1.2018.3
  Fetching uglifier 4.1.8
  Installing uglifier 4.1.8
  Bundle complete! 11 Gemfile dependencies, 59 gems now installed.
  Use `bundle info [gemname]` to see where a bundled gem is installed.

要创建数据库,我导航到项目文件夹,然后运行以下命令:

rake db:create:all

我收到了这个错误:

$ rake db:create:all
rake aborted!
LoadError: no such file to load -- active_record/connection_adapters/postgresql/explain_pretty_printer
C:/Users/Luke/Documents/Aptana/readlyme-test-perfect/config/application.rb:7:in `(root)'
C:/Users/Luke/Documents/Aptana/readlyme-test-perfect/rakefile:1:in `block in (root)'
C:/Users/Luke/Documents/Aptana/readlyme-test-perfect/rakefile:4:in `(root)'
(See full trace by running task with --trace)

我需要帮助。谢谢。

3 个答案:

答案 0 :(得分:1)

在运行此rails new readlyme-test-perfect -d postgresq之前,您确定安装了postgresql gem吗?尝试重新安装。

gem uninstall pg
gem install pg

答案 1 :(得分:1)

在经历了很多类似的问题及其答案后,我意识到我的问题的原因来自Ruby安装。虽然我正在关注Rails和Heroku的官方文档但是运行JRuby 9.1.8.I和Ruby2.3并不是一个好的文档。使用Ruby2.3和Devkit,我能够安装rails并可以方便地使用slite3和mysql适配器。我不知道它也将用于postgresql。当我安装JRuby时,它会覆盖Ruby rails安装,并且可以创建一个rails项目,就像我在这里发布的问题一样。

要解决这个问题,我只需卸载JRuby,将其从环境变量中删除,在系统重启后,我安装rails并使用以下命令创建一个rails项目:rails new readlyme-test-perfect -d postgresql < / strong>每件事都像魅力一样。 现在借助这个Heroku Docs我已经将我的应用程序部署在heroku中,迁移我的数据库,现在可以方便地从Aptana3编码。

非常感谢所有贡献者。

答案 2 :(得分:0)

对于那些想留在JRuby(OP显然切换回C Ruby)的人,我能够通过在我的Gemfile中强制使用旧版本来实现这一点:

gem "activerecord-jdbcpostgresql-adapter", "1.3.24", :platform => :jruby

自动下拉的版本&gt; = 50.0与其他依赖项的版本冲突(如Rails 4.2.8)