【问题标题】:Gem Issues with rbenv and bundlerrbenv 和 bundler 的 Gem 问题
【发布时间】:2013-01-30 19:27:11
【问题描述】:

我使用 Ruby 1.9.3-p374 安装了 rbenv,并且我安装了 gem 打包器。

然后我设置了一个项目目录并在其中设置了一个 .ruby-version 文件以选择我的 1.9.3 ruby​​ 版本,然后添加了一个带有一些 gem 的 gemfile,如指南针等。然后我运行 bundle install --path vendor 并安装了它。

如果我然后运行 ​​bundle show 我会得到:

Gems included by the bundle:
  * bundler (1.2.3)
  * chunky_png (1.2.7)
  * compass (0.12.2)
  * fssm (0.2.10)
  * sass (3.2.5)
  * susy (1.0.5)

如果我运行gem list,我会得到:

*** LOCAL GEMS ***

bigdecimal (1.1.0)
bundler (1.2.3)
io-console (0.3)
json (1.5.4)
minitest (2.5.1)
rake (0.9.2.2)
rdoc (3.9.4)

我如何让他们一起工作。我希望像 compass 等本地项目 gem 像它们一样安装到供应商目录中,但是当我 cd 进入我的项目目录并运行 compass watch 命令时,我得到-bash: compass: command not found

为什么它不起作用?

【问题讨论】:

    标签: ruby gem bundler gemfile


    【解决方案1】:

    当从您的供应商包(而不是本地 gem)运行 gem 时,您应该使用 bundle exec

    ~/project$ bundle exec compass watch
    

    如果您想直接运行 Compass,您必须使用 vanilla bundle install 或简单的 gem install compass 将它安装在您的系统(本地 gem)上。 (在这种情况下,您有时可能会遇到 gem 版本冲突,Gemfile 与从系统调用)

    【讨论】:

    • 太棒了!有没有办法让它在从该项目中调用时始终捆绑 exec?
    • @rctneil 我不知道有什么明显的方法可以做到这一点,不,我通常在本地安装我的以便懒惰地运行命令的原因;o) 你有理由需要运行吗它们来自您的供应商捆绑包?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-02-21
    • 1970-01-01
    • 2012-03-25
    • 2019-05-31
    • 2011-12-19
    相关资源
    最近更新 更多