简体   繁体   English

Bundler / Rails找不到新安装的宝石

[英]Bundler / Rails cannot find newly installed Gems

I have searched around quite a bit here already to ensure that this question has not been asked previously. 我已经在这里进行了很多搜索,以确保以前没有问过这个问题。 While there have been a plethora of similar cases, I was not able to find anyone else experiencing my situation. 尽管有很多类似的案例,但我找不到其他遇到我的情况的人。

My situation is that Rails / Bundler cannot find any reference to my newly installed Gems. 我的情况是Rails / Bundler找不到对我新安装的Gems的任何引用。 In this instance, Nokogiri. 在这种情况下,Nokogiri。

This is the error I am getting when trying to run bundle install 这是我尝试运行bundle install时遇到的错误

Could not find gem 'nokogori (>= 0) ruby' in the gems available on this machine.

This is a brand new install of OS X Yosemite, so I think a core step may have just been missed somewhere? 这是OS X Yosemite的全新安装,因此我认为核心步骤可能已经错过了?

I have used Thoughtbots "Laptop" script to install all of my dev stuff because there's a tonne of overlap with my usual tools, plus installed Rails after that. 我使用了Thoughtbots的“笔记本电脑”脚本来安装我所有的开发人员资料,因为与我通常使用的工具有很多重叠,然后还要安装Rails。

https://github.com/thoughtbot/laptop https://github.com/thoughtbot/laptop

Here are the steps I am taking to reproduce the error 这是我要重现该错误的步骤

Install Nokogiri 安装Nokogiri

Lukes-MBP% gem install nokogiri
Building native extensions.  This could take a while...
Successfully installed nokogiri-1.6.6.2
Parsing documentation for nokogiri-1.6.6.2
Done installing documentation for nokogiri after 2 seconds
1 gem installed

Add to Gemfile 添加到Gemfile

gem 'nokogori'

Ensure it's installed 确保已安装

Lukes-MBP% whereis nokogiri
/usr/bin/nokogiri

And here is my gem environment output 这是我的gem environment输出

RubyGems Environment:
- RUBYGEMS VERSION: 2.4.5
- RUBY VERSION: 2.2.0 (2014-12-25 patchlevel 0) [x86_64-darwin14]
- INSTALLATION DIRECTORY: /Users/lukerollans/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0
- RUBY EXECUTABLE: /Users/lukerollans/.rbenv/versions/2.2.0/bin/ruby
- EXECUTABLE DIRECTORY: /Users/lukerollans/.rbenv/versions/2.2.0/bin
- SPEC CACHE DIRECTORY: /Users/lukerollans/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /Users/lukerollans/.rbenv/versions/2.2.0/etc
- RUBYGEMS PLATFORMS:
  - ruby
  - x86_64-darwin-14
- GEM PATHS:
   - /Users/lukerollans/.rbenv/versions/2.2.0/lib/ruby/gems/2.2.0
   - /Users/lukerollans/.gem/ruby/2.2.0
- GEM CONFIGURATION:
   - :update_sources => true
   - :verbose => true
   - :backtrace => false
   - :bulk_threshold => 1000
- REMOTE SOURCES:
   - https://rubygems.org/
- SHELL PATH:
   - /Users/lukerollans/.rbenv/versions/2.2.0/bin
   - /usr/local/Cellar/rbenv/0.4.0/libexec
   - /Users/lukerollans/.rbenv/shims
   - /usr/local/bin
   - /Users/lukerollans/.bin
   - /usr/local/bin
   - /usr/bin
   - /bin
   - /usr/sbin
   - /sbin

This has been bugging me for hours now, so if anyone can shed any light on what I'm doing wrong, that would be super! 这已经困扰了我好几个小时,因此,如果有人可以阐明我在做什么错,那就太好了!

Try checking your ruby version using 尝试使用检查您的红宝石版本

$ rvm list

to check your ruby version, and then change to proper ruby version using 检查您的红宝石版本,然后使用更改为正确的红宝石版本

$ rvm use 2.2.0

then install nokogiri using 然后使用安装nokogiri

$ gem install nokogiri

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

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