Tag: rubygems

Nokogiri本机扩展无法构建(不是libxml2或libxslt缺少问题)

正如标题所说,它似乎没有失败,因为缺少libxml2或libxslt。 我不确定该怎么做错误。 (得到它?因为问题出在制作期间?嘿嘿……) Anywho,这是我得到的输出。 任何想法,将不胜感激: Building native extensions. This could take a while… ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension. /usr/bin/ruby1.9.1 extconf.rb extconf.rb:10: Use RbConfig instead of obsolete and deprecated Config. checking for libxml/parser.h… yes checking for libxslt/xslt.h… yes checking for libexslt/exslt.h… yes checking for iconv_open() in iconv.h… yes checking for […]

我可以有条件地跳过在同一个文件中加载“更多”ruby代码吗?

我可以有条件地跳过在同一个文件中加载“更多”ruby代码, 如果找不到库(通过require加载)? begin require ‘aws-sdk’ rescue LoadError puts “aws-sdk gem not found” return #does not work. nor does next end # code after here should not be executed as `aws-sdk` gem was not found puts “=== should not get executed” namespace :db do desc “import local postgres database to heroku. user and database name is […]

如何使用bundler创建相互依赖的gem,并使用存储库作为源?

如何创建相互依赖的gem,仍然使用Bundler? 现在,如果library-a Gemfile如下所示: gem ‘library-b’ gem ‘library-c’ 并且library-b的Gemfile读取如下: gem ‘library-a’ gem ‘library-c’ 并且library-c的Gemfile读取: gem ‘library-a’, github: ‘library-root/library-a’, branch: ‘master’ gem ‘library-b’, github: ‘library-root/library-b’, branch: ‘master’ 当您尝试为library-c运行bundle update和/或bundle install ,这是输出: Your Gemfile requires gems that depend depend on each other, creating an infinite loop. Please remove either gem ‘library-a’ or gem ‘library-b’ and try again. 对于library-a或library-b将发生相同消息的变体。 […]

试图访问我的ruby项目 – 与mysql有关的LoadError

我正在尝试访问我的第一个ruby项目。 导航到正确的目录并键入: $ rails服务器 我收到以下错误消息: /Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2.rb:7:in require’: dlopen(/Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError) Referenced from: /Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle Reason: image not found – /Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle from /Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2.rb:7:in require’: dlopen(/Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError) Referenced from: /Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle Reason: image not found – /Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle from /Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2.rb:7:in require’: dlopen(/Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError) Referenced from: /Users/Rozey/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle […]

Rails :: Railtie:无法创建Rails 3 gem

我真的可以用另一套眼睛,所以我想我会把它贴在这里。 不久前我为自己的教育目的写了一个基本的ActiveRecord扩展。 我最近一直在阅读有关Railties的内容,并认为我会尝试使用Rails 3.我想我会把它打包成一块gem来了解这个过程。 如果我跳过Railtie并在初始化文件夹中将其作为传统的monkeypatch执行,它可以正常工作。 使用铁路……没什么。 从它的外观来看,我的Railtie永远不会被执行,因此似乎没有其他任何事情发生。 这里有人看错了吗? 我们也欢迎任何有关最佳实践或改进的建议。 项目Gemfile: gem ‘sql_explain’, :path => “/home/mike/projects/sql_explain/” gemspec: … spec.files = %w(README.rdoc sql_explain.rb lib/sql_explain.rb lib/railtie.rb sql_explain.gemspec) … sql_explain.rb require ‘lib/railtie.rb’ railtie.rb require ‘active_record’ require ‘sql_explain’ module SqlExplain class Railtie < Rails::Railtie railtie_name :sql_explain initializer 'sql_explain.extend.activerecord' do if defined?(ActiveRecord) ActiveRecord::ConnectionAdapters::MysqlAdapter.include SqlExplain::AR end end end end sql_explain.rb module SqlExplain […]

尝试运行gem install时出错

我正在尝试在我的开发服务器上运行并运行。 这是一个fedora14盒子。 我安装了rvm,ruby 1.8.7和rubygems 1.6.2。 当我尝试通过gem, gem install rails ,我收到以下错误: ERROR: Loading command: install (LoadError) no such file to load — zlib ERROR: While executing gem … (NameError) uninitialized constant Gem::Commands::InstallCommand 关于发生了什么的任何想法。 我是ruby / ruby​​gems / rails的100%新手,我对Linux有足够的了解,所以任何帮助/建议都会非常感激。 提前致谢

gem install memcached失败

在做 gem install memcached 以下错误被抛出。 …. …. checking for pod2man… /usr/bin/pod2man ./configure: line 22468: syntax error near unexpected token `sasl,,’ ./configure: line 22468: ` AC_LIB_HAVE_LINKFLAGS(sasl,,’ make: *** [config.status] Error 2 *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more […]

如何在gem环境中设置正确的Ruby版本

注意:这个问题涉及如何让bundler使用chruby和.ruby-version设置的Ruby版本? 。 使用chruby我在macOS上安装了Ruby 1.8.7: $ ruby -v ruby 1.8.7 (2013-06-27 patchlevel 374) [i686-darwin17.4.0] 另外,我使用gem update –system 1.8.30安装特定版本的RubyGems,我希望它是兼容的。 这似乎安装正确: $ gem –version 1.8.30 但是,我的RubyGems环境显示了不正确的Ruby版本(2.5.0): $ gem env RubyGems Environment: – RUBYGEMS VERSION: 1.8.30 – RUBY VERSION: 2.5.0 (2017-12-25 patchlevel 0) [x86_64-darwin17] – INSTALLATION DIRECTORY: /Users/keithpitty/.gem/ruby/1.8.7 – RUBY EXECUTABLE: /usr/local/opt/ruby/bin/ruby – EXECUTABLE DIRECTORY: /Users/keithpitty/.gem/ruby/1.8.7/bin – RUBYGEMS PLATFORMS: […]

Nokogiri 1.5.2无法在Ubuntu 11.10上安装

真的很快,我知道一个类似的问题 。 但是,遵循最高评级的答案是行不通的。 我已经重新启动了我的系统和终端,但无济于事。 出于某种原因,Nokogiri没有意识到我安装了libxslt1-dev ,虽然我明确安装了它,但是使用了sudo apt-get install libxslt-dev和sudo apt-get install libxslt1-dev 。 这是输出; 我错过了什么吗? $ gem install nokogiri -v ‘1.5.2’ Building native extensions. This could take a while… ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension. ~/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb extconf.rb:10: Use RbConfig instead of obsolete and deprecated Config. checking for libxml/parser.h… yes […]

在我的mac上更新gem – 安装了两个版本的bundler

我在RVM之前和之后安装了我的本地机器上的大量gem,所以我决定将它们全部擦除并重新安装。 一切似乎都没问题,除了捆绑: gem list ….. bundler (1.1.3, 1.0.22) 我不知道为什么1.0.22仍然存在,我无法弄清楚如何摆脱它! $ gem cleanup Cleaning up installed gems… Attempting to uninstall bundler-1.0.22 Unable to uninstall bundler-1.0.22: Gem::InstallError: gem “bundler” is not installed Clean Up Complete $ gem uninstall bundler-1.0.22 INFO: gem “bundler-1.0.22” is not installed 更新安德鲁要求的路径信息 /Users/brandon/.rvm/gems/ruby-1.9.3-p125-perf@global/gems/bundler-1.0.22/