Tag: rubygems

安装mysql2 gem时出错:无法构建gem原生扩展

Windows XP。 Ruby 1.9.2。 安装了Rails。 MySQL已安装。 当我尝试运行gem install mysql2 (或bundle install )时,我收到错误: C:\ruby\cred2>gem install mysql2 Building native extensions. This could take a while… ERROR: Error installing mysql2: ERROR: Failed to build gem native extension. C:/Ruby192/bin/ruby.exe extconf.rb checking for rb_thread_blocking_region()… *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary […]

在Ubuntu上的rvm下的ruby gems(未能)安装在错误的位置

我正在运行Ubuntu 10.04并且最初安装了ruby 1.9.1(来自源代码)。 我刚刚决定尝试使用ruby 1.9.2和rails 3,这似乎是使用rvm来处理多个ruby安装和gemsets的好时机。 安装了rvm并且似乎正在工作,我在rvm中安装了ruby 1.9.2并将其作为我的默认ruby。 但是,每当我尝试在ruby 1.9.2下安装gem时,我都会看到此错误。 mark@Steve-Austins-Penguin:~$ gem install haml ERROR: While executing gem … (Errno::EACCES) Permission denied – /home/mark/.gem/specs gem environment回归: RubyGems Environment: – RUBYGEMS VERSION: 1.3.7 – RUBY VERSION: 1.9.2 (2010-08-18 patchlevel 0) [x86_64-linux] – INSTALLATION DIRECTORY: /home/mark/.rvm/gems/ruby-1.9.2-p0 – RUBY EXECUTABLE: /home/mark/.rvm/rubies/ruby-1.9.2-p0/bin/ruby – EXECUTABLE DIRECTORY: /home/mark/.rvm/gems/ruby-1.9.2-p0/bin – RUBYGEMS PLATFORMS: […]

在Ruby中安全地需要gem

有没有办法安全地要求rubygem,以便在没有找到gem时不引发exception? 我正在寻找一个接近这个的解决方案: if require ‘hirb’ # do some hirb related stuff else # do other stuff end 我希望这能确保没有不必要的gem使我的部署失败。

无法在Mac OS X 10.8.4上安装json 1.8 gem

我正在尝试在第二台计算机上安装我的rails应用程序。 但是当我运行bundle install我得到了json gem的错误: Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension. /Users/feuerball/.rvm/rubies/ruby-2.0.0-p195/bin/ruby extconf.rb /Users/feuerball/.rvm/rubies/ruby-2.0.0-p195/bin/ruby: invalid option -D (-h will show valid options) (RuntimeError) Gem files will remain installed in /Users/feuerball/.rvm/gems/ruby-2.0.0-p195/gems/json-1.8.0 for inspection. Results logged to /Users/feuerball/.rvm/gems/ruby-2.0.0-p195/gems/json-1.8.0/ext/json/ext/generator/gem_make.out An error occurred while installing json (1.8.0), and Bundler cannot continue. Make sure that `gem install json -v […]

AWS框上的Unicorn工作人员超时

我正在尝试在AWS盒子上设置一个Unicorn,但是工作人员只是保持计时,我不知道为什么。 我正在使用Ubuntu Server 14.04 LTS AMI,安装标准Ruby on Rails安装所需的一切。 使用rails new,我生成一个空的应用程序,第一次尝试访问它似乎很快,但在此之后,工作人员只是持续超时并永远服务于网页。 加载标准WEBrick服务器没有这个问题,几乎立即加载页面。 我试过回滚几个版本的ruby和独角兽没有运气。 VM中本地不会发生此行为。 以下是在调试模式下运行的服务器的日志 我,[2014-11-04T18:30:13.290599#17134]信息 – :收听addr = 0.0.0.0:5000 fd = 10 I,[2014-11-04T18:30:13.362993#17134]信息 – :主过程就绪 I,[2014-11-04T18:30:13.363098#17137] INFO – :worker = 0 ready I,[2014-11-04T18:30:13.365175#17140] INFO – :worker = 1 ready I,[2014-11-04T18:30:13.365314#17142] INFO – :worker = 2 ready /var/lib/gems/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:443中的exception’LoadError’ – 无法加载此类文件 – rails / application_helper.rb /var/lib/gems/2.1.0/gems/activesupport-4.1.7/lib/active_support/dependencies.rb:352中的exception’LoadError’ – […]

Rails new给出“无法在任何来源中找到正确版本的铁路(4.2.5.1)”错误

我试图使用Rails 5.0.0.rc1与Ruby 2.3.1。 但是,如果我尝试在“编程”目录中创建一个新项目,我会得到:  ➜ ~/Documents/Programming rails new foo Could not find proper version of railties (4.2.5.1) in any of the sources Run `bundle install` to install missing gems. 如果我做一个gem列表,我在5.0.0.rc1中安装了唯一的rails版本。 有趣的是,当我执行rails -v时,我得到了同样的错误,但是当我从我的主目录中执行时,请不要这样做:  ➜ ~ rails -v Rails 5.0.0.rc1  ➜ ~ cd Documents/Programming  ➜ ~/Documents/Programming rails -v Could not find proper version […]

无效的规范缓存文件

我在Windows 8上安装了带有Gem 2.2.2的ruby 2.0.0p247 [x64-mingw32]。我有一个持久性问题gem,使它几乎无法使用。 每当我尝试安装新gem时,我总会得到: ERROR: While executing gem … Invalid spec cache file in C:/Users/… 在过去,我已经能够运行gem update或gem update –system ,这将解决单个 gem install 。 后续安装将失败并出现相同的错误。 现在甚至gem更新失败并显示该错误消息。 我试过删除users/…/.gem目录。 当我这样做时, gem update重新创建该目录并立即失败,并显示相同的错误消息。 我用gem重新安装了ruby 1.9.8几次试图解决问题,然后升级到ruby 2.0.0。 在所有重新安装和升级过程中,问题仍然存在。 我在这里结束了我的智慧。 任何人都可以帮我解决这个问题吗? 这是编辑中的回溯“ L:\xampp\htdocs\frameworks\yii2\framework>gem update –backtrace Updating installed gems ERROR: While executing gem … (Gem::Exception) Invalid spec cache file in […]

如何使rake测试不使用默认的minitest?

我正在关注RubyGems的Make your own Gem Guide。 执行rake test指令失败如下: > rake test ~/.rbenv/versions/2.1.2/lib/ruby/2.1.0/minitest/unit.rb:26:in `const_missing’: uninitialized constant MiniTest::Test (NameError) 我认为这是因为使用的最小版本是4.7.5而不是5.6.0 (或者使MiniTest::Test有效所需的任何5.0.0系列)。 所以我安装了minitest 5.6.0 ,现在我有两个版本的minitest 。 但是rake test仍然只使用4.7.5版本。 我如何制作它以便运行rake test在指南的设置中使用正确的minitest ? 直接使用ruby工作: > ruby -Ilib test/test_hola.rb Run options: –seed 48777 # Running: … Finished in 0.002862s, 1048.3550 runs/s, 1048.3550 assertions/s. 3 runs, 3 assertions, 0 failures, 0 errors, 0 […]

Bundler如何在Gemfile中单独在一个文件中单独要求gems?

我在rspec和mocha之间存在冲突(rspec不使用mocha,但其他最小的测试是)。 如果我把mocha放在我的gemfile中(即使是require:false),它也会被activesupport / test_case.rb加载:15 silence_warnings { require ‘mocha/setup’ } 然后导致rspec到barf。 所以,我想在我的系统gems的test_setup文件中要求它,但我无法弄清楚如何在bundler之外加载gem。 关于如何让这些gem玩得很好的其他想法值得欢迎。

gem安装但’rails’命令不起作用

当我运行任何rails命令,如rails s我收到以下错误: 在任何源代码中找不到diff-lcs-1.1.2尝试运行bundle install 。 但是,我已经安装了diff-lcs。 bundle show diff-lcs /opt/local/lib/ruby1.9/gems/1.9.1/gems/diff-lcs-1.1.2 当我执行gem list命令时,我也看到了diff-lcs 我的GEM_HOME是/opt/local/lib/ruby1.9/gems/1.9.1 作为参考,这是我的Gemfile的内容: source ‘http://rubygems.org’ gem ‘rails’, ‘3.0.0’ gem ‘sqlite3-ruby’, ‘1.2.5’, :require => ‘sqlite3’ group :development do gem ‘rspec-rails’, ‘2.0.0’ end group :test do gem ‘rspec’, ‘2.0.0’ gem ‘webrat’, ‘0.7.1’ end 并且which rails的输出是/usr/bin/rails