首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >Rails部署到heroku“检测到rails配置失败”和"/usr/bin/env:‘ruby.exe\r’:没有这样的文件或目录“

Rails部署到heroku“检测到rails配置失败”和"/usr/bin/env:‘ruby.exe\r’:没有这样的文件或目录“
EN

Stack Overflow用户
提问于 2019-04-25 07:14:12
回答 2查看 855关注 0票数 0

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

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

我得到两个截然不同的错误(我认为它们可能是相关的)。

首先:

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

然后:

remote: Detecting rails configuration failed

我在Stackoverflow中搜索以寻找解决方案,我尝试申请:

windows heroku run rake db:migrate error "/usr/bin/env: ruby.exe: No such file or directory"

但它不起作用。

此外,我还尝试在我的git bash中执行:

代码语言:javascript
复制
dos2unix bin/bundle bin/rake bin/rails

我注意到的是,我已经将ruby.exe更改为ruby (如上所述),这并不重要,heroku仍然部署寻找ruby.exe\r

这是我第二次在heroku中部署Rails项目,第一次没有任何问题,第二次我克隆了该项目并将其用作模板,使用了不同的git存储库。

谢谢!

更新2:

我可以使用heroku本地运行它,没有问题,所以我不确定是什么导致了这个错误。

编辑3个

好的,我应用了这两个答案中的内容:heroku /usr/bin/env: ‘ruby.exe\r’: No such file or directory problem https://help.github.com/en/articles/dealing-with-line-endings

现在:'remote: /usr/bin/env:‘ruby.exe\r’:没有这样的文件或目录‘

不会再出现了。

获取rails配置仍然失败。以下是日志:

代码语言:javascript
复制
(erb):12:in `<main>': undefined method `[]' for nil:NilClass (NoMethodError)
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/ruby-2.5.3/lib/ruby/2.5.0/erb.rb:876:in `eval'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/ruby-2.5.3/lib/ruby/2.5.0/erb.rb:876:in `result'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies/interlock.rb:13:in `loading'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:37:in `load_interlock'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:334:in `depend_on'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:246:in `require_dependency'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:477:in `each'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:475:in `each'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:475:in `eager_load!'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/engine.rb:356:in `eager_load!'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application/finisher.rb:69:in `each'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `instance_exec'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:32:in `run'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:228:in `block in tsort_each'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:431:in `each_strongly_connected_component_from'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:349:in `block in each_strongly_connected_component'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:347:in `each'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:347:in `call'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:347:in `each_strongly_connected_component'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:226:in `tsort_each'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/ruby-2.5.3/lib/ruby/2.5.0/tsort.rb:205:in `tsort_each'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/initializable.rb:60:in `run_initializers'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:361:in `initialize!'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/config/environment.rb:5:in `<top (required)>'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:291:in `require'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/application.rb:337:in `require_environment!'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/command/actions.rb:28:in `require_environment!'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/command.rb:27:in `run'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor/invocation.rb:126:in `invoke_command'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/thor-0.20.3/lib/thor.rb:387:in `dispatch'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/command/base.rb:65:in `perform'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/command.rb:46:in `invoke'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/railties-5.2.3/lib/rails/commands.rb:18:in `<top (required)>'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/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_1139d3f60c8f9853c7eca09a6e6cc23a/vendor/bundle/ruby/2.5.0/gems/activesupport-5.2.3/lib/active_support/dependencies.rb:257:in `load_dependency'
remote:         from /tmp/build_1139d3f60c8f9853c7eca09a6e6cc23a/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>'
EN

回答 2

Stack Overflow用户

发布于 2019-04-25 12:41:05

嗯,我通过执行以下操作修复了这个问题:

我设置了配置:

代码语言:javascript
复制
heroku config:set AWS_ACCESS_KEY_ID=<something>
heroku config:set AWS_SECRET_ACCESS_KEY=<something>
heroku config:set AWS_REGION=<something>
heroku config:set S3_BUCKET_NAME=<something>

这并不是完全有帮助,但我再次注意到我错过了master.key。

我还确保我的config/enviroment/production.rb具有:

代码语言:javascript
复制
config.require_master_key = true

所以我也添加了配置:

代码语言:javascript
复制
heroku config:set RAILS_MASTER_KEY=<something>

之后我又做了一次“git推送heroku大师”

而且它起作用了。

票数 1
EN

Stack Overflow用户

发布于 2019-04-25 07:26:53

运行包更新,删除heroku git,然后重新创建heroku应用程序

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55839762

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档