简体   繁体   English

捆绑包未安装的宝石

[英]Gems not installed by bundle install

After clearing out my gems with rvm gemset empty , I re-installed rails (3.2.13) and then deleted my Gemfile.lock and ran bundle install . 在清除了rvm gemset empty gem之后,我重新安装了rails(3.2.13),然后删除了Gemfile.lock并运行bundle install Bundler doesn't installed gems, it just says it's "using" them as if they're already installed. Bundler没有安装gem,它只是说正在“使用”它们,就好像它们已经被安装一样。 So when I try to run the app, I'm told "Could not find [gem namne] in any of the sources (Bundler::GemNotFound)". 因此,当我尝试运行该应用程序时,系统会告诉我“在任何来源(Bundler :: GemNotFound)中都找不到[gem namne]”。

Edit: I was running sudo bundle install because one of the gems is installed from a local source. 编辑:我正在运行sudo bundle install因为其中一个gem是从本地源安装的。 When using sudo , the gems are not installed. 使用sudo ,未安装gem。 When just running bundle install , Bundler does try to install the missing gems but it can't install the bootstrap-sass gem which is coming from a local source. 仅在运行bundle install ,Bundler会尝试安装缺少的gem,但无法安装来自本地来源的bootstrap-sass gem。

Gemfile 宝石文件

source "https://rubygems.org"

gem "rails", "~> 3.2.13"
gem "mysql2", "~> 0.3.13"
gem "json", "~> 1.8.0"

group :assets do
  gem "guard-rails-assets", "~> 0.1.3"
  gem "sass-rails", "~> 3.2.6"
  gem "coffee-rails", "~> 3.2.2"
  gem "uglifier", "~> 1.0.3"
end

gem "jquery-rails", "~> 3.0.4"
gem "simple_form", "~> 2.1.0"
gem "bootstrap-sass", :path => "gems/bootstrap-sass-c0e12a90ba3e"
gem "client_side_validations", "~> 3.2.6"
gem "client_side_validations-simple_form", "~> 2.1.0"
gem "therubyracer", :platform => :ruby
gem "require_relative", "~> 1.0.3"
gem "icalendar", "~> 1.4.3"
gem "whenever", "~> 0.8.4", :require => false
gem "jquery-cookie-rails", "~> 1.3.1"
gem "hominid", "~> 3.0.5"

gem list

*** LOCAL GEMS ***

actionmailer (3.2.13)
actionpack (3.2.13)
activemodel (3.2.13)
activerecord (3.2.13)
activeresource (3.2.13)
activesupport (3.2.13)
arel (3.0.3)
builder (3.0.4)
bundler (1.5.2)
bundler-unload (1.0.2)
daemon_controller (1.1.8)
erubis (2.7.0)
executable-hooks (1.3.1)
gem-wrappers (1.2.4)
hike (1.2.3)
i18n (0.6.1)
journey (1.0.4)
json (1.8.1)
mail (2.5.4)
mime-types (1.25.1)
multi_json (1.8.4)
passenger (4.0.35)
polyglot (0.3.3)
rack (1.4.5)
rack-cache (1.2)
rack-ssl (1.3.3)
rack-test (0.6.2)
rails (3.2.13)
railties (3.2.13)
rake (10.1.1)
rdoc (3.12.2)
rubygems-bundler (1.4.2)
rvm (1.11.3.8)
sprockets (2.2.2)
thor (0.18.1)
tilt (1.4.1)
treetop (1.4.15)
tzinfo (0.3.38)

Why isn't bundle installing the gems in my Gemfile? 为什么不将bundle安装在我的Gemfile中?

When you run sudo bundle install you're probably using a different instance of bundler (either you have another instance of RVM installed globally for your system, or you're just using the default system ruby) 当您运行sudo bundle install您可能正在使用捆绑程序的其他实例(您在系统中全局安装了另一个RVM实例,或者仅使用了默认的系统ruby)

As a result, it will install the gems for that system ruby. 结果,它将为该系统的ruby安装宝石。 If you later open the server without using sudo it will look for the gems in your local RVM, which does not have the Installing with just ``bundle install is the correct way. 如果您稍后在不使用sudo情况下打开服务器,它将在您的本地RVM中查找gems,而本地RVM中没有``bundle install``bundle install是正确的``bundle install方式``bundle install What you should do instead is fix that path error from bootstrap-sass. 相反,您应该做的是从bootstrap-sass修复该路径错误。 Which, by the way, is probably occuring because of the same problem You probably have a path "gems/bootstrap-sass-c0e12a90ba3e" in your system ruby, but not on your local RVM 顺便说一句,可能是由于相同的问题而发生的。您的系统红宝石中可能有一个路径"gems/bootstrap-sass-c0e12a90ba3e" ,但在本地RVM上却没有

我猜您应该将您的bootstrap-sass gem版本放在没有root特权的目录中。

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

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