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

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

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby on Rails 5

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

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

GitHub

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

Q&A

解決済

2回答

364閲覧

git push heroku masterの際のNameerror  ※しかも見当たらない

piyo_tan

総合スコア16

Ruby on Rails 5

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

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

GitHub

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

0グッド

0クリップ

投稿2018/10/04 12:09

編集2018/10/07 03:36

表題の内容通りです。
git push heroku masterの際、エラーが発生してpushできません。
以下、エラー内容です。

NameError: undefined local variable or method `otetsudainetto' for #<Otetsudai::Application:0x0055c997390358> remote: ! Precompiling assets failed. remote: ! remote: ! Push rejected, failed to compile Ruby app. remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to otetsudainetto. ``` エラー内容全文 ``` remote: Cleaning up the bundler cache. remote: Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.1). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`. remote: The latest bundler is 1.17.0.pre.1, but you are currently running 1.15.2. remote: To update, run `gem install bundler --pre` remote: -----> Installing node-v8.10.0-linux-x64 remote: -----> Detecting rake tasks remote: -----> Preparing app for Rails asset pipeline remote: Running: rake assets:precompile remote: rake aborted! remote: NameError: undefined local variable or method `otetsudainetto' for #<Otetsudai::Application:0x0055c997390358> remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/config/environments/production.rb:98:in `block in <main>' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/railtie.rb:216:in `instance_eval' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/railtie.rb:216:in `configure' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/config/environments/production.rb:1:in `<main>' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/engine.rb:602:in `block (2 levels) in <class:Engine>' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/engine.rb:601:in `each' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/engine.rb:601:in `block in <class:Engine>' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:32:in `instance_exec' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:32:in `run' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:61:in `block in run_initializers' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:50:in `each' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:50:in `tsort_each_child' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/initializable.rb:60:in `run_initializers' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/application.rb:361:in `initialize!' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/config/environment.rb:5:in `<main>' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `block in require_with_bootsnap_lfi' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:65:in `register' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:20:in `require_with_bootsnap_lfi' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/bootsnap-1.3.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:29:in `require' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `block in require' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:253:in `load_dependency' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/activesupport-5.2.1/lib/active_support/dependencies.rb:287:in `require' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/application.rb:337:in `require_environment!' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/railties-5.2.1/lib/rails/application.rb:520:in `block in run_tasks_blocks' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:62:in `block (2 levels) in define' remote: /tmp/build_acf97b5e854585e77c3ad71b7dcf66d1/vendor/bundle/ruby/2.4.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>' remote: Tasks: TOP => environment remote: (See full trace by running task with --trace) remote: remote: ! remote: ! Precompiling assets failed. remote: ! remote: ! Push rejected, failed to compile Ruby app. remote: remote: ! Push failed remote: Verifying deploy... remote: remote: ! Push rejected to otetsudainetto. remote: To https://git.heroku.com/otetsudainetto.git ! [remote rejected] master -> master (pre-receive hook declined) error: failed to push some refs to 'https://git.heroku.com/otetsudainetto.git' ``` 自分でも調べているのですが、いまいち原因がわからなかったので、質問させていただきました。 ご教示の喉よろしくお願いいたします。 ※追記です。 NameError: undefined local variable or method `otetsudainetto' for <Otetsudai::Application:0x0055c997390358>の 『otetsudainetto』を捜しているのですが、まったく見当たりません。 そもそも、、そのような変数、メソッドにおぼえがありません。 以前、otetsudainettoというアプリを開発していて挫折してしまい、今回はnewotetsudainetto と名前を変えて挑戦しています。 変な話なのですが、どこを探していけば、このエラー元『otetsudainetto』を発見できるのでしょうか? 自分で探せよという話ですが、簡単なアドバイスでいいので、ご回答お待ちしております。

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

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

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

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

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

guest

回答2

0

ベストアンサー

とりあえず、探し方の提案として
git grep -P "(?<!new)otetsudainetto"
でリポジトリ内の管理しているファイルを検索できます。

ただ、なんとなく環境変数なども調べる必要があるかな?と思います
heroku configで一覧が取れるようです

投稿2018/10/07 05:30

asm

総合スコア15147

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

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

piyo_tan

2018/10/07 15:13

git grep便利ですね...。初めてしりました。大変勉強になります。 色々と調べた結果、sendgridを使うために設定した host = 'polar-hollows-53728.herokuapp.com' config.action_mailer.default_url_options = { host: polar-hollows-53728.herokuapp.com } の記述の仕方が間違っておりました。 以前は、polar-hollows-53728ではなく、otetsudainetoがhost名だったため、それも輪をかけてわからなくなってしまいました。 ご協力いただきありがとうございました。
guest

0

とりあえず質問文からは「otetsudainetto」という変数もしくはメソッドはないよと
いうのが読み取れます。
それを書いているあたりを見直してみましょう。

投稿2018/10/04 12:21

dice142

総合スコア5158

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

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

piyo_tan

2018/10/07 03:37

なんどか探してはいますが、まさかの見当たりません、、、。 そもそも,そんな変数、メソッドに覚えがないので、苦戦しております、。
dice142

2018/10/07 03:55

エラーを見るとconfig/environments/production.rbにあるようです。
piyo_tan

2018/10/07 04:54

質問ばかりで申し訳ないのですが、その記述がどうしても見つかりません。 どこでそのようなエラーが発生しているのでしょうか? 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 = false # `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 = "otetsudai_#{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 config.action_mailer.raise_delivery_errors = true config.action_mailer.delivery_method = :smtp host = 'polar-hollows-53728.herokuapp.com' config.action_mailer.default_url_options = { host: polar-hollows-53728.herokuapp.com } ActionMailer::Base.smtp_settings = { :address => 'smtp.sendgrid.net', :port => '587', :authentication => :plain, :user_name => ENV['SENDGRID_USERNAME'], :password => ENV['SENDGRID_PASSWORD'], :domain => 'heroku.com', :enable_starttls_auto => true } end
dice142

2018/10/07 06:16

たしかに見た感じ使われてなさそうですね。 asm様の仰るように環境変数の問題などかもしれません。
piyo_tan

2018/10/07 15:12

色々とアドバイスをいただきありがとうございました。 大変勉強になりました。 色々と調べた結果、sendgridを使うために設定した host = 'polar-hollows-53728.herokuapp.com' config.action_mailer.default_url_options = { host: polar-hollows-53728.herokuapp.com } の記述の仕方が間違っておりました。 以前は、polar-hollows-53728ではなく、otetsudainetoがhost名だったため、それも輪をかけてわからなくなってしまいました。 ご協力いただきありがとうございました。
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

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

ただいまの回答率
85.48%

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

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

質問する

関連した質問