Rails部署到heroku“ Detecting rails configuration failed” 和 “/usr/bin/env: ‘ruby.exe\r’: No such file or directory”

内容来源于 Stack Overflow,并遵循CC BY-SA 3.0许可协议进行翻译与使用

  • 回答 (1)
  • 关注 (0)
  • 查看 (73)

我将rails应用程序部署到heroku时收到错误消息

我在Windows笔记本电脑上编码。

我得到两个明显的错误(我认为它们可能是相关的)。

第一:

remote: /usr/bin/env: ‘ruby.exe\r’: No such file or directory

然后:

remote: Detecting rails configuration failed

我尝试在git bash中执行:

dos2unix bin/bundle bin/rake bin/rails

注意到,将ruby.exe更改为ruby并不重要(如上所述),heroku仍在部署中寻找 ruby.exe\r

更新2:

使用heroku local可以运行,所以我不知道什么是causin错误。

设置heroku HEROKU_DEBUG_RAILS_RUNNER = 1,得到以下日志:

$ git push heroku master
Counting objects: 1, done.
Writing objects: 100% (1/1), 179 bytes | 179.00 KiB/s, done.
Total 1 (delta 0), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.5.3
remote:
remote: ###### WARNING:
remote:
remote:        Removing `Gemfile.lock` because it was generated on Windows.
remote:        Bundler will do a full resolve so native gems are handled properly.
remote:        This may result in unexpected gem versions being used in your app.
remote:        In rare occasions Bundler may not be able to resolve your dependencies at all.
remote:        https://devcenter.heroku.com/articles/bundler-windows-gemfile
remote:
remote: -----> Installing dependencies using bundler 2.0.1
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4
remote:        The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
remote:        Fetching gem metadata from https://rubygems.org/............
remote:        Fetching gem metadata from https://rubygems.org/.
remote:        Resolving dependencies.............
remote:        Using rake 12.3.2
                <....>
remote:        Bundle completed (7.37s)
remote:        Cleaning up the bundler cache.
remote: -----> Installing node-v10.14.1-linux-x64
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        /usr/bin/env: ‘ruby.exe\r’: No such file or directory
remote:        Asset precompilation completed (2.56s)
remote:        Cleaning assets
remote:        Running: rake assets:clean
remote: -----> Detecting rails configuration
remote:        $ rails runner "begin; puts %Q{heroku.detecting.config.for.assets.compile=#{Rails.application.config.try(:assets).try(:compile)}}; rescue => e; puts e; puts e.backtrace; end; begin; puts %Q{heroku.detecting.config.for.action_dispatch.x_sendfile_header=#{Rails.application.config.try(:action_dispatch).try(:x_sendfile_header)}}; rescue => e; puts e; puts e.backtrace; end; begin; puts %Q{heroku.detecting.config.for.active_storage.service=#{Rails.application.config.try(:active_storage).try(:service)}}; rescue => e; puts e; puts e.backtrace; end;"
remote:        (erb):12:in `<main>': undefined method `[]' for nil:NilClass (NoMethodError)
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/ruby-2.5.3/lib/ruby/2.5.0/erb.rb:876:in `eval'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/ruby-2.5.3/lib/ruby/2.5.0/erb.rb:876:in `result'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activestorage-5.2.3/lib/active_storage/engine.rb:95:in `block (2 levels) in <class:Engine>'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:71:in `instance_eval'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:71:in `block in execute_hook'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:62:in `with_execution_control'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:67:in `execute_hook'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:52:in `block in run_load_hooks'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:51:in `each'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/lazy_load_hooks.rb:51:in `run_load_hooks'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activestorage-5.2.3/app/models/active_storage/blob.rb:235:in `<class:Blob>'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activestorage-5.2.3/app/models/active_storage/blob.rb:16:in `<top (required)>'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:378:in `block in require_or_load'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:37:in `block in load_interlock'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies/interlock.rb:14:in `block in loading'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/concurrency/share_lock.rb:151:in `exclusive'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies/interlock.rb:13:in `loading'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:37:in `load_interlock'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:356:in `require_or_load'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/active_support.rb:48:in `block in require_or_load'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/active_support.rb:16:in `allow_bootsnap_retry'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/active_support.rb:47:in `require_or_load'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:334:in `depend_on'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/active_support.rb:85:in `depend_on'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:246:in `require_dependency'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:478:in `block (2 levels) in eager_load!'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:477:in `each'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:477:in `block in eager_load!'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:475:in `each'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:475:in `eager_load!'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:356:in `eager_load!'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application/finisher.rb:69:in `each'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application/finisher.rb:69:in `block in <module:Finisher>'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `instance_exec'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `run'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:61:in `block in run_initializers'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:350:in `block (2 levels) in each_strongly_connected_component'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:347:in `each'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:347:in `call'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:60:in `run_initializers'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:361:in `initialize!'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/config/environment.rb:5:in `<top (required)>'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:337:in `require_environment!'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/command/actions.rb:28:in `require_environment!'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/command/actions.rb:15:in `require_application_and_environment!'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/commands/runner/runner_command.rb:29:in `perform'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/command/base.rb:65:in `perform'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/command.rb:46:in `invoke'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<top (required)>'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `block in require_with_bootsnap_lfi'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:21:in `require_with_bootsnap_lfi'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/bootsnap-1.4.4/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `block in require'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
remote:         from /tmp/build_3a0f20f5c461a5e9077e7a5d7c6f8232/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
remote:         from bin/rails:4:in `<main>'
remote:
remote: ###### WARNING:
remote:
remote:        Removing `Gemfile.lock` because it was generated on Windows.
remote:        Bundler will do a full resolve so native gems are handled properly.
remote:        This may result in unexpected gem versions being used in your app.
remote:        In rare occasions Bundler may not be able to resolve your dependencies at all.
remote:        https://devcenter.heroku.com/articles/bundler-windows-gemfile
remote:
remote: ###### WARNING:
remote:
remote:        Detecting rails configuration failed
remote:
remote: ###### WARNING:
remote:
remote:        We detected that some binary dependencies required to
remote:        use all the preview features of Active Storage are not
remote:        present on this system.
remote:
remote:        For more information please see:
remote:          https://devcenter.heroku.com/articles/active-storage-on-heroku
remote:
remote:
remote:
remote: -----> Discovering process types
remote:        Procfile declares types     -> web
remote:        Default types for buildpack -> console, rake
remote:
remote: -----> Compressing...
remote:        Done: 51.9M
remote: -----> Launching...
remote:        Released v9
remote:        https://rupipest.herokuapp.com/ deployed to Heroku
remote:
remote: Verifying deploy... done.
To https://git.heroku.com/rupipest.git
   5ec0016..2acd22a  master -> master
提问于
用户回答回答于

运行捆绑包更新,删除heroku git,然后再次创建heroku应用程序

扫码关注云+社区

领取腾讯云代金券