简体   繁体   English

Heroku-如何解决“无法加载此类文件-工头/ cli(LoadError)”的问题? -[Java,Windows,Ruby-on-rails]

[英]Heroku - How to fix “cannot load such file — foreman/cli (LoadError)” ? - [Java, Windows, Ruby-on-rails]

I'm following the official Heroku Java tutorial: 我正在关注官方的Heroku Java教程:

Getting Started with Java on Heroku Heroku上的Java入门

I've succesfully followed every step up to 我成功地遵循了每一步

Run the app locally 在本地运行应用

Running the command described in this step: 运行此步骤中描述的命令:

foreman start web

that on Windows needs to use a specific Procfile: Windows上需要使用特定的Procfile:

foreman start web -f Procfile.windows

I get the following error: 我收到以下错误:

C:\Users\Andrea>foreman start web -f Procfile.windows
C:/Program Files (x86)/Heroku/ruby-1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.r
b:36:in `require': cannot load such file -- foreman/cli (LoadError)
        from C:/Program Files (x86)/Heroku/ruby-1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/cus
tom_require.rb:36:in `require'
        from C:/Program Files (x86)/Heroku/bin/foreman:8:in `<main>'

What causes the problem, and how can I fix it ? 是什么原因导致该问题,我该如何解决?

Thanks @AndreaLigios for posting my solution on StackOverflow. 感谢@AndreaLigios将我的解决方案发布在StackOverflow上。

@Gespejo is getting below problem taken from GitHub: @Gespejo正在解决来自GitHub的问题:

I installed heroku in the c:\\Heroku directory but it's still not working. 我将heroku安装在c:\\ Heroku目录中,但仍无法正常工作。 Can you help me? 你能帮助我吗? Thanks 谢谢

 C:>foreman C:/Heroku/ruby-1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require': cannot load such file -- foreman/cli(LoadError) from C:/Heroku/ruby-1.9.3/lib/ruby/ site_ruby/1.9.1/rubygems/custom_requi re.rb:36:inrequire' from C:/Heroku/bin/foreman:8:in 

Follow the below Steps: 请按照以下步骤操作:

  • Uninstall Heroku Toolbelt completely from your computer. 从计算机上完全卸载Heroku Toolbelt
  • Uninstall Foreman gem by using command gem uninstall 'foreman' . 使用命令gem uninstall 'foreman'来卸载Foreman gem。
  • Now install Heroku Toolbelt again 现在再次安装Heroku Toolbelt
  • Check foreman is working now or not by running command foreman that will list all commands option supported by foreman 通过运行命令foreman来检查foreman是否正在工作,该命令将列出foreman支持的所有命令选项

Let us know if problem has solved after executing above listed steps. 执行上面列出的步骤后,让我们知道问题是否已解决。

The error is caused by the fact that: 该错误是由以下事实引起的:

Foreman does not work if your installation of Heroku has any special characters or spaces in any directory name or in directory Hierarchy 如果您在Heroku的安装中的任何目录名称或目录层次结构中具有任何特殊字符或空格,则Foreman不起作用

(thanks to @theajaygupta for finding the solution ) (感谢@theajaygupta 找到解决方案

Since the Heroku Toolbelt for Windows installation is defaulting the Heroku path to 由于用于WindowsHeroku Toolbelt安装默认将Heroku路径设置为

C:\\Program Files (x86)\\Heroku C:\\ Program Files(x86)\\ Heroku

, everyone following the tutorial on Windows will get this error. ,按照Windows教程上的每个人都会遇到此错误。

The solution is simple: reinstall the Heroku Toolbelt for Windows specifying a path without spaces and special characters. 解决方案很简单: 为Windows 重新安装 Heroku Toolbelt,指定没有空格和特殊字符的路径。 For example: 例如:

Valid 有效

  • C:\\Heroku C:\\的Heroku
  • C:\\SeemsLegitIn2015\\Heroku C:\\ SeemsLegitIn2015 \\的Heroku

Not Valid 无效

  • C:\\Program Files (x86)\\Heroku C:\\ Program Files(x86)\\ Heroku
  • C:\\Progra~2\\Heroku C:\\ PROGRA〜2 \\的Heroku

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM