Search code examples
phpsymfonysassbundlercompass

Could not find gem installed with bundler


For my PHP Symfony Application I need Compass and Sass. Both should be installed in the vendor/bundle folder of my project.

This is what I did so far:

$ 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.

Well now it comes to my problem. When i execute one of the installed gems I get the following error:

$ 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>'

I get that it looks in the $GEM_PATH and of course cannot find it. But how do i resolve this issue? I don't want to change the gem path to the project folder.


Solution

  • With Bundle you should launch the application with the Bundle Exec command. For launch compass you can do, as example:

    $ bundle exec compass watch
    

    or

    $ bundle exec compass compile
    

    Check this nice article about further info.

    Hope this help