【问题标题】:Could not find gem installed with bundler找不到使用捆绑程序安装的 gem
【发布时间】:2015-08-06 21:08:43
【问题描述】:

对于我的 PHP Symfony 应用程序,我需要 Compass 和 Sass。两者都应该安装在我项目的vendor/bundle 文件夹中。

这是我到目前为止所做的:

$ gem install bundler
Successfully installed bundler-1.10.6
1 gem installed

$ bundle install --path vendor/bundle
Fetching gem metadata from https://rubygems.org/...........
Fetching version metadata from https://rubygems.org/...
Fetching dependency metadata from https://rubygems.org/..
// ... Installing some gems
Using bundler 1.10.6
Bundle complete! 2 Gemfile dependencies, 10 gems now installed.
Bundled gems are installed into ./vendor/bundle.

现在我的问题来了。当我执行其中一个已安装的 gem 时,出现以下错误:

$ vendor/bundle/ruby/1.9.1/bin/compass 
/usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:315:in `to_specs': Could not find 'compass' (>= 0) among 30 total gem(s) (Gem::LoadError)
Checked in 'GEM_PATH=/usr/local/rvm/gems/ruby-1.9.3-p551:/usr/local/rvm/gems/ruby-1.9.3-p551@global', execute `gem env` for more information
    from /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:324:in `to_spec'
    from /usr/local/rvm/rubies/ruby-1.9.3-p551/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_gem.rb:64:in `gem'
    from vendor/bundle/ruby/1.9.1/bin/compass:22:in `<main>'

我知道它在 $GEM_PATH 中查找,当然找不到它。但是我该如何解决这个问题?我不想更改项目文件夹的 gem 路径。

【问题讨论】:

  • 尝试使用此命令执行:bundle exec compass
  • 行得通,谢谢 :)
  • 嗨@van 我可以将其作为答案发布,以便您关闭问题吗?
  • @Matteo 当然,只要您提供答案,我就会接受。谢谢

标签: php symfony sass bundler compass


【解决方案1】:

使用Bundle,您应该使用Bundle Exec command 启动应用程序。对于启动指南针,您可以这样做,例如:

$ bundle exec compass watch

$ bundle exec compass compile

查看this nice article了解更多信息。

希望有帮助

【讨论】:

    猜你喜欢
    • 2013-09-02
    • 2011-04-06
    • 2011-12-11
    • 1970-01-01
    • 2017-10-26
    • 2016-11-26
    • 1970-01-01
    • 2021-04-11
    • 1970-01-01
    相关资源
    最近更新 更多