質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Git LFS

Git LFSは、巨大なバイナリファイルをGitでバージョン管理する機能です。Gitはソースコードを管理するツールのため重くなりがちですが、Git LFSはその問題を解決する機能をGitの拡張として提供します。

Git

Gitはオープンソースの分散バージョン管理システム(DVCS)です。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

GitHub

GitHubは、Gitバージョン管理システムを利用したソフトウェア開発向けの共有ウェブサービスです。GitHub商用プランおよびオープンソースプロジェクト向けの無料アカウントを提供しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

Q&A

解決済

1回答

1586閲覧

herokuでgit push heroku masterが通らない(rails)

aspot_0734

総合スコア19

Git LFS

Git LFSは、巨大なバイナリファイルをGitでバージョン管理する機能です。Gitはソースコードを管理するツールのため重くなりがちですが、Git LFSはその問題を解決する機能をGitの拡張として提供します。

Git

Gitはオープンソースの分散バージョン管理システム(DVCS)です。

Heroku

HerokuはHeroku社が開発と運営を行っているPaaSの名称です。RubyやNode.js、Python、そしてJVMベース(Java、Scala、Clojureなど)の複数のプログラミング言語をサポートしている。

GitHub

GitHubは、Gitバージョン管理システムを利用したソフトウェア開発向けの共有ウェブサービスです。GitHub商用プランおよびオープンソースプロジェクト向けの無料アカウントを提供しています。

Ruby on Rails

Ruby on Railsは、オープンソースのWebアプリケーションフレームワークです。「同じことを繰り返さない」というRailsの基本理念のもと、他のフレームワークより少ないコードで簡単に開発できるよう設計されています。

0グッド

0クリップ

投稿2020/03/28 00:41

herokuでgit push heroku masterを実行すると、以下のようなエラーが出てしまいます。
こちらのサイトを参考にしました)
想像でいいので、間違っている可能性のある部分を教えていただけませんか?
試したことなども下に乗せています。

C:\Users\user>git push heroku master Enumerating objects: 4234, done. Counting objects: 100% (4234/4234), done. Delta compression using up to 4 threads Compressing objects: 100% (3792/3792), done. Writing objects: 100% (4234/4234), 10.54 MiB | 1.91 MiB/s, done. Total 4234 (delta 544), reused 0 (delta 0), pack-reused 0 remote: Compressing source files... done. remote: Building source: remote: remote: ! No default language could be detected for this app. remote: HINT: This occurs when Heroku cannot detect the buildpack to use for this application automatically. remote: See https://devcenter.heroku.com/articles/buildpacks remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to sheltered-crag-86184. remote: To https://git.heroku.com/sheltered-crag-86184.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/sheltered-crag-86184.git'

その前にやったこと

前述のサイトのとおり、

  • ・gemfileでデータベースの変更
  • ・config/datebase.ymlを変更
  • ・config/environments/production.rbを変更
  • ・bin以下のフォルダを変更

を行ったつもりです。
###変更したファイル一覧
bin/bundle

#!/usr/bin/env ruby ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) load Gem.bin_path('bundler', 'bundle')

gemfile

1source 'https://rubygems.org' 2git_source(:github) { |repo| "https://github.com/#{repo}.git" } 3 4ruby '2.5.1' 5 6# Bundle edge Rails instead: gem 'rails', github: 'rails/rails' 7gem 'rails', '~> 5.2.4', '>= 5.2.4.1' 8# Use sqlite3 as the database for Active Record 9#gem 'sqlite3' 10# Use Puma as the app server 11gem 'puma', '~> 3.11' 12# Use SCSS for stylesheets 13gem 'sass-rails', '~> 5.0' 14# Use Uglifier as compressor for JavaScript assets 15gem 'uglifier', '>= 1.3.0' 16# See https://github.com/rails/execjs#readme for more supported runtimes 17gem 'duktape' 18# Use CoffeeScript for .coffee assets and views 19gem 'coffee-rails', '~> 4.2' 20# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks 21gem 'turbolinks', '~> 5' 22# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder 23gem 'jbuilder', '~> 2.5' 24# Use Redis adapter to run Action Cable in production 25# gem 'redis', '~> 4.0' 26# Use ActiveModel has_secure_password 27# gem 'bcrypt', '~> 3.1.7' 28 29# Use ActiveStorage variant 30# gem 'mini_magick', '~> 4.8' 31 32# Use Capistrano for deployment 33# gem 'capistrano-rails', group: :development 34 35# Reduces boot times through caching; required in config/boot.rb 36 37gem 'bootsnap', '>= 1.1.0', require: false 38 39gem 'bcrypt' 40 41group :development, :test do 42 gem 'sqlite3' 43 # Call 'byebug' anywhere in the code to stop execution and get a debugger console 44 gem 'byebug', platforms: [:mri, :mingw, :x64_mingw] 45end 46 47group :development do 48 # Access an interactive console on exception pages or by calling 'console' anywhere in the code. 49 gem 'web-console', '>= 3.3.0' 50end 51 52group :test do 53 # Adds support for Capybara system testing and selenium driver 54 gem 'capybara', '>= 2.15' 55 gem 'selenium-webdriver' 56 # Easy installation and use of chromedriver to run system tests with Chrome 57 gem 'chromedriver-helper' 58end 59 60# Windows does not include zoneinfo files, so bundle the tzinfo-data gem 61gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby] 62 63group :production do 64 gem 'pg' 65end 66

config/datebase.yml

# SQLite version 3.x # gem install sqlite3 # # Ensure the SQLite 3 gem is defined in your Gemfile # gem 'sqlite3' # default: &default adapter: sqlite3 pool: <%= ENV.fetch("RAILS_MAX_THREADS") { 5 } %> timeout: 5000 development: <<: *default database: db/development.sqlite3 # Warning: The database defined as "test" will be erased and # re-generated from your development database when you run "rake". # Do not set this db to the same as development or production. test: <<: *default database: db/test.sqlite3 production: <<: *default adapter: postgresql encoding: unicode pool: 5

config/environments/production.rb

Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.cache_classes = true # Eager load code on boot. This eager loads most of Rails and # your application in memory, allowing both threaded web servers # and those relying on copy on write to perform better. # Rake tasks automatically ignore this option for performance. config.eager_load = true # Full error reports are disabled and caching is turned on. config.consider_all_requests_local = false config.action_controller.perform_caching = true # Ensures that a master key has been made available in either ENV["RAILS_MASTER_KEY"] # or in config/master.key. This key is used to decrypt credentials (and other encrypted files). # config.require_master_key = true # Disable serving static files from the `/public` folder by default since # Apache or NGINX already handles this. config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present? # Compress JavaScripts and CSS. config.assets.js_compressor = :uglifier # config.assets.css_compressor = :sass # Do not fallback to assets pipeline if a precompiled asset is missed. config.assets.compile = true # `config.assets.precompile` and `config.assets.version` have moved to config/initializers/assets.rb # Enable serving of images, stylesheets, and JavaScripts from an asset server. # config.action_controller.asset_host = 'http://assets.example.com' # Specifies the header that your server uses for sending files. # config.action_dispatch.x_sendfile_header = 'X-Sendfile' # for Apache # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for NGINX # Store uploaded files on the local file system (see config/storage.yml for options) config.active_storage.service = :local # Mount Action Cable outside main process or domain # config.action_cable.mount_path = nil # config.action_cable.url = 'wss://example.com/cable' # config.action_cable.allowed_request_origins = [ 'http://example.com', /http://example.*/ ] # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies. # config.force_ssl = true # Use the lowest log level to ensure availability of diagnostic information # when problems arise. config.log_level = :debug # Prepend all log lines with the following tags. config.log_tags = [ :request_id ] # Use a different cache store in production. # config.cache_store = :mem_cache_store # Use a real queuing backend for Active Job (and separate queues per environment) # config.active_job.queue_adapter = :resque # config.active_job.queue_name_prefix = "chat_spot_#{Rails.env}" config.action_mailer.perform_caching = false # Ignore bad email addresses and do not raise email delivery errors. # Set this to true and configure the email server for immediate delivery to raise delivery errors. # config.action_mailer.raise_delivery_errors = false # Enable locale fallbacks for I18n (makes lookups for any locale fall back to # the I18n.default_locale when a translation cannot be found). config.i18n.fallbacks = true # Send deprecation notices to registered listeners. config.active_support.deprecation = :notify # Use default logging formatter so that PID and timestamp are not suppressed. config.log_formatter = ::Logger::Formatter.new # Use a different logger for distributed setups. # require 'syslog/logger' # config.logger = ActiveSupport::TaggedLogging.new(Syslog::Logger.new 'app-name') if ENV["RAILS_LOG_TO_STDOUT"].present? logger = ActiveSupport::Logger.new(STDOUT) logger.formatter = config.log_formatter config.logger = ActiveSupport::TaggedLogging.new(logger) end # Do not dump schema after migrations. config.active_record.dump_schema_after_migration = false end

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

git pushのログを見ると、

remote: ! No default language could be detected for this app.

となっているので、heroku側がrailsアプリだと自動的に認識できなかったのだと思われます。
Herokuの管理画面から、rubyのビルドパックを入れた上で再度試してみてはどうでしょうか?

投稿2020/03/28 04:26

s_eric

総合スコア184

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

aspot_0734

2020/03/28 08:02

いろいろ調べて、デスクトップからherokuの設定画面のビルドパックを追加したのですが、また同じエラーが出てしまいます。ビルドパックの欄には「heroku/ruby」と表示されています。
s_eric

2020/03/28 08:37

ビルドパックの設定はそれであっています。 添付のログを見ると、 C:\Users\user>git push heroku master となっており、Windowsのユーザーのホームのディレクトリ(C:\Users\user)でgit push heroku masterをしているように見えます。 git push heroku masteは、Railsアプリのルートディレクトリで実行されていますか?
aspot_0734

2020/03/28 08:52

cd で移動してからまたやってみましたが、なぜかできません。 可能性でいいので、またお願いします。
s_eric

2020/03/28 09:12

Railsアプリのルートディレクトリで、git initされてますか? まだしてないのなら、git initした後、git add .をしてコミットしてください。
aspot_0734

2020/03/28 09:36

デプロイできました! しかし、そのURLにアクセスすると Method Not Allowed となってしまいます。 別の質問として出してこの質問は閉じたほうが良いでしょうか?
s_eric

2020/03/28 10:32

そうですね。ここで、出されている情報では、Method Not Allowedの原因を探りづらいので、別の質問として、経緯や関連のコードとともに出されたほうがよいと思います。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問