簡體   English   中英

嘿,我正在嘗試在 heroku 上部署一個 Rails 應用程序,當我運行 git push heroku master 時收到以下錯誤消息

[英]hey I am trying to deploy a rails app on heroku, and i get the follow error message when i run git push heroku master

    remote:        
    Gem::LoadError: 
    **strong text**Specified 'postgresql' for database adapter, but the 
     gem is not loaded. Add `gem 'pg'` to your Gemfile (and ensure its 
      version is at the minimum required by ActiveRecord).

我在 gem 文件中加載了這個:

    source 'https://rubygems.org'

    git_source(:github) do |repo_name|
   repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?
    ("/") "https://github.com/#{repo_name}.git"
    end

Gems: gem 'jquery-rails' gem 'active_model_serializers', '0.10.6' # 捆綁邊緣 Rails 代替: gem 'rails', github: 'rails/rails' gem 'rails', '~> 5.1.3' # 使用sqlite3 作為 Active Record 的數據庫 # 使用 Puma 作為應用服務器 gem 'puma', '~> 3.7' # 樣式表使用 SCSS gem 'sass-rails', '~> 5.0' # 使用 Uglifier 作為 JavaScript 資產的壓縮器 gem 'uglifier', '>= 1.3.0' # 更多支持的運行時請參見https://github.com/rails/execjs#readme # gem 'therubyracer',platforms: :ruby

    # Use CoffeeScript for .coffee assets and views
    gem 'coffee-rails', '~> 4.2'
    # Turbolinks makes navigating your web application faster. Read 
    more: 
    https://github.com/turbolinks/turbolinks
    gem 'turbolinks', '~> 5'
    # Build JSON APIs with ease. Read more: 
    https://github.com/rails/jbuilder
    gem 'jbuilder', '~> 2.5'
    # Use Redis adapter to run Action Cable in production
    # gem 'redis', '~> 3.0'
    # Use ActiveModel has_secure_password
    # gem 'bcrypt', '~> 3.1.7'
    gem 'nokogiri'

    # Use Capistrano for deployment
    # gem 'capistrano-rails', group: :development

    group :development, :test do
    # Call 'byebug' anywhere in the code to stop execution and get a 
    debugger console
    gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
    # Adds support for Capybara system testing and selenium driver
    gem 'sqlite3'
    gem 'capybara', '~> 2.13'
    gem 'selenium-webdriver'
    end

    group :production do
    gem 'pg'
    end

    group :development do
     # Access an IRB console on exception pages or by using <%= console 
     %> anywhere in the code.
    gem 'web-console', '>= 3.3.0'
    gem 'listen', '>= 3.0.5', '< 3.2'
    # Spring speeds up development by keeping your application running 
    in the background. Read more: https://github.com/rails/spring
    gem 'spring'
    gem 'spring-watcher-listen', '~> 2.0.0'
    end

    # Windows does not include zoneinfo files, so bundle the tzinfo-
    data gem
    gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
    gem 'devise'
    gem 'omniauth-facebook'
    gem 'flash'
    gem 'pry'

^^寶石文件結束

我運行了 bundle install -without production 。 這是行不通的。 不知道我哪里出錯了。

在您的 gemfile 中指定 pg 的版本。 我曾經收到同樣的錯誤,這條線對我有用。

gem 'pg', '~> 0.18' 

而不僅僅是 gem 'pg'

移動線

gem 'pg'

外部group :production

所以 gem 將安裝在任何類型的環境中

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM