问题描述
我有一个网站使用。之前在另一台计算机上与版本和RVM混淆后,在这一个版本中,我选择只使用捆绑器的一个版本的Ruby和每个项目环境。
一个非常简单的 Gemfile
:
[$]> cat Gemfile
source'https://rubygems.org'
gem'github-pages'
和bundler config:
[$]> cat .bundle / config
---
BUNDLE_PATH:env
BUNDLE_DISABLE_SHARED_GEMS:'1'
当我通过 bundle exec
运行任何命令(jekyll,gem,irb)时,出现依赖关系错误:
[$]> bundle exec jekyll
在任何源代码中都找不到RedCloth-4.2.9
运行`bundle install`安装缺失的gem。
但是,该捆绑包已经安装:
[$]> bundle install
使用RedCloth 4.2.9
使用i18n 0.6.11
使用json 1.8.1
[snip]
使用github页面29
使用捆绑商1.7.7
您的捆绑已完成!
它被安装到./env
我有点不知所措以及bundler如何使用一个子命令来安装宝石,但认为它们在使用另一个子命令时缺少。
[$ ] GT; ruby
/ usr / local / bin / ruby
[$]>其中打包者
/ usr / local / bin / bundler
[$]> ruby --version
ruby 2.2.0p0(2014-12-25 revision 49005)[x86_64-darwin14]
[$]> bundler --version
Bundler version 1.7.7
env 目录并重新安装后,我发现它为两个Ruby版本创建了子目录 - 2.1.0和2.2.0。后者是我目前使用的Ruby版本,但目录是空的(所有的gem都安装在 env / ruby / 2.1.0 / gems
目录中)。这与Oliver关于rbenv的回答一起让我想到了不匹配的版本。
我用一个简单的 gem install bundler重新安装了捆绑器
,reran bundle install
,并且都很好。
看起来总的来说,答案是与安装不同版本的Ruby的捆绑程序相比,您遇到的问题不是您实际使用的。看起来很奇怪,它会为 bundle install
和另一个用于 bundle exec
,但是* shrug * whatever 。
I have a website using Jekyll with Github Pages. After previously messing about with versions and RVM on another computer, on this one I opted to stick with just one version of Ruby and per-project environments using bundler.
I have a pretty simple Gemfile
:
[$]> cat Gemfile
source 'https://rubygems.org'
gem 'github-pages'
and bundler config:
[$]> cat .bundle/config
---
BUNDLE_PATH: env
BUNDLE_DISABLE_SHARED_GEMS: '1'
When I run any command (jekyll, gem, irb) through bundle exec
, I get a dependency error:
[$]> bundle exec jekyll
Could not find RedCloth-4.2.9 in any of the sources
Run `bundle install` to install missing gems.
However, the bundle is already installed:
[$]> bundle install
Using RedCloth 4.2.9
Using i18n 0.6.11
Using json 1.8.1
[snip]
Using github-pages 29
Using bundler 1.7.7
Your bundle is complete!
It was installed into ./env
I'm at a bit of a loss as to how bundler can think the gems are installed when using one subcommand, but think they're missing when using another.
[$]> which ruby
/usr/local/bin/ruby
[$]> which bundler
/usr/local/bin/bundler
[$]> ruby --version
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
[$]> bundler --version
Bundler version 1.7.7
After deleting the env
directory and reinstalling, I noticed it created subdirectories for two Ruby versions - 2.1.0 and 2.2.0. The latter was my current version of Ruby, but the directory was empty (all the gems were installed into the env/ruby/2.1.0/gems
directory). This, combined with Oliver's answer about rbenv, got me thinking about mismatched versions.
I reinstalled bundler with a simple gem install bundler
, reran bundle install
, and all is good.
It seems in general the answer is to sort out issues with bundler installing for a different version of Ruby than you're actually using. It seems strange to me it would use one thing for bundle install
and another for bundle exec
, but *shrug* whatever.
这篇关于'bundle exec'抱怨没有安装gem,即使'bundle install'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!