无法加载这样的文件 - readline(LoadError)在运行heroku时创建 - 堆雪松 [英] cannot load such file -- readline (LoadError) when running heroku create --stack cedar
本文介绍了无法加载这样的文件 - readline(LoadError)在运行heroku时创建 - 堆雪松的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图将我的Rails应用程序部署到Heroku中,按照以下说明进行测试:
$ b http://devcenter.heroku.com/articles/rails3#prerequisites
这里是我试图运行的命令:
heroku create --stack cedar
我得到以下错误信息:
/home/sergio/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in`require':无法加载这样的文件 - readline(LoadError )从/home/sergio/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in`require'
from /home/sergio/.rvm/gems/ruby-1.9.3-p125/gems/heroku-2.20.1/lib/heroku/command/run.rb:1:in`< top(required)>' $ / b / b来自/home/sergio/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from /home/sergio/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in`require'
from /home/sergio/.rvm/gems/ruby-1.9.3-p125/gems/heroku-2.20.1/lib/heroku/command.rb:14:in`block in load'
from /home/sergio/.rvm/gems/ruby-1.9.3-p125/gems/heroku-2.20.1/lib/heroku/command.rb:13:in'each'
from / home / sergio / .rvm / gems / ruby-1.9.3-p125 / gems / heroku-2.20.1 / lib / heroku / command.rb:13:`load'
from /home/sergio/.rvm/gems/ ruby-1.9.3-p125 / gems / heroku-2.20.1 / lib / heroku / cli.rb:8:在'start'
从/home/sergio/.rvm/gems/ruby-1.9.3 -p125 / gems / heroku-2.20.1 / bin / heroku:15:在<< top(required)>'
from /home/sergio/.rvm/gems/ruby-1.9.3-p125 / bin / heroku:19:`load'
from /home/sergio/.rvm/gems/ruby-1.9.3-p125/bin/heroku:19:in`< main>'
这是有问题的文件的内容:
# -
#Copyright 2006 by Chad Fowler,Rich Kilmer,Jim Weirich等人。
#保留所有权利。
#请参阅LICENSE.txt获取权限。
#++
模块内核
如果已定义?(gem_original_require)然后
#Ruby带有custom_require,覆盖它的require
remove_method:require
else
##
#加载RubyGems之前的内核#需求。
alias gem_original_require require
private:gem_original_require
end
##
#当需要RubyGems时,Kernel#require会被我们的拥有哪些
#能够按需加载宝石。
#
#当您调用< tt> require'x'< / tt>时,会发生以下情况:
#*如果可以从现有的Ruby加载路径加载文件,它
#是。
#*否则,会搜索已安装的gems以查找匹配的文件。
#如果在gem'y'中找到该宝石,则激活该宝石(添加到
#加载路径中)。
#
#正常< tt>要求< / tt>如果
#该文件已被加载,则返回false的功能将被保留。
def需要路径
如果Gem.unresolved_deps.empty?那么
gem_original_require path
else
spec = Gem :: Specification.find {| s |
s.activated?和s.contains_requirable_file?路径
}
除非规范然后
found_specs = Gem :: Specification.find_in_unresolved路径
除非found_specs.empty?然后
found_specs = [found_specs.last]
else
found_specs = Gem :: Specification.find_in_unresolved_tree path
end
found_specs.each do | found_spec |
found_spec.activate
end
end
return gem_original_require path
end
rescue LoadError => load_error
如果load_error.message.end_with?(path)和Gem.try_activate(path)then
return gem_original_require(path)
end
raise load_error
结束
私人:需要
结束
我可以使用
rails -s
在本地运行我的应用程序,但我似乎无法将其发布到Heroku。解决方案iltempo和buru的答案帮助了我:
sudo apt-get install libreadline -dev
rvm remove 1.9.3
rvm install 1.9.3
然后添加到您的Gemfile:
gem'rb-readline'
I'm trying to deploy my Rails application to Heroku to test it out by following these instructions:
http://devcenter.heroku.com/articles/rails3#prerequisites
Here is the command I'm trying to run:
heroku create --stack cedar
And I get this error message:
/home/sergio/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- readline (LoadError) from /home/sergio/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /home/sergio/.rvm/gems/ruby-1.9.3-p125/gems/heroku-2.20.1/lib/heroku/command/run.rb:1:in `<top (required)>' from /home/sergio/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /home/sergio/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require' from /home/sergio/.rvm/gems/ruby-1.9.3-p125/gems/heroku-2.20.1/lib/heroku/command.rb:14:in `block in load' from /home/sergio/.rvm/gems/ruby-1.9.3-p125/gems/heroku-2.20.1/lib/heroku/command.rb:13:in `each' from /home/sergio/.rvm/gems/ruby-1.9.3-p125/gems/heroku-2.20.1/lib/heroku/command.rb:13:in `load' from /home/sergio/.rvm/gems/ruby-1.9.3-p125/gems/heroku-2.20.1/lib/heroku/cli.rb:8:in `start' from /home/sergio/.rvm/gems/ruby-1.9.3-p125/gems/heroku-2.20.1/bin/heroku:15:in `<top (required)>' from /home/sergio/.rvm/gems/ruby-1.9.3-p125/bin/heroku:19:in `load' from /home/sergio/.rvm/gems/ruby-1.9.3-p125/bin/heroku:19:in `<main>'
And this is the content of the file in question:
#-- # Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others. # All rights reserved. # See LICENSE.txt for permissions. #++ module Kernel if defined?(gem_original_require) then # Ruby ships with a custom_require, override its require remove_method :require else ## # The Kernel#require from before RubyGems was loaded. alias gem_original_require require private :gem_original_require end ## # When RubyGems is required, Kernel#require is replaced with our own which # is capable of loading gems on demand. # # When you call <tt>require 'x'</tt>, this is what happens: # * If the file can be loaded from the existing Ruby loadpath, it # is. # * Otherwise, installed gems are searched for a file that matches. # If it's found in gem 'y', that gem is activated (added to the # loadpath). # # The normal <tt>require</tt> functionality of returning false if # that file has already been loaded is preserved. def require path if Gem.unresolved_deps.empty? then gem_original_require path else spec = Gem::Specification.find { |s| s.activated? and s.contains_requirable_file? path } unless spec then found_specs = Gem::Specification.find_in_unresolved path unless found_specs.empty? then found_specs = [found_specs.last] else found_specs = Gem::Specification.find_in_unresolved_tree path end found_specs.each do |found_spec| found_spec.activate end end return gem_original_require path end rescue LoadError => load_error if load_error.message.end_with?(path) and Gem.try_activate(path) then return gem_original_require(path) end raise load_error end private :require end
I can run my application locally using
rails -s
, but I just can't seem to publish it to Heroku.解决方案iltempo and buru's answers helped me:
sudo apt-get install libreadline-dev rvm remove 1.9.3 rvm install 1.9.3 Then add to your Gemfile: gem 'rb-readline'
这篇关于无法加载这样的文件 - readline(LoadError)在运行heroku时创建 - 堆雪松的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文