[compass] no such file to load -- compass

1,145 views
Skip to first unread message

Yong Bakos

unread,
Apr 27, 2010, 5:38:52 PM4/27/10
to Compass
Hello,

I've a weird issue that's become difficult to troubleshoot, I wonder
if anyone's encountered and solved this.

When running my app or the console, an error is raised (no such file
to load -- compass) saying that it couldn't load compass. Issue is not
evident in development or production environments, only a staging
environment.

However, compass is installed. I can irb:
require 'rubygems'
require 'compass'
true

This is a rails 2.3.5 app. I have:
config/compass.config
config/initializers/compass.rb
vendor/gems/compass/.specification

I've even tried a fresh standalone app on the staging server:
rails compass_test -m http://compass-style.org/rails/installer

And when running script/server I do get the same error:
no such file to load -- compass
...stacktrace...

Never had this happen w/ Compass before...

--
You received this message because you are subscribed to the Google Groups "Compass" group.
To post to this group, send email to compas...@googlegroups.com.
To unsubscribe from this group, send email to compass-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/compass-users?hl=en.

Yong Bakos

unread,
Apr 27, 2010, 6:00:05 PM4/27/10
to Compass

I found a resolution to this issue. In environment.rb, above the
Rails::Initializer block, I added the explicit:

require 'compass'

And it now runs properly on the staging env. But can anyone explain
why this may be necessary?



On Apr 27, 3:38 pm, Yong Bakos <humanorien...@gmail.com> wrote:
> Hello,
>
> I've a weird issue that's become difficult to troubleshoot, I wonder
> if anyone's encountered and solved this.
>
> When running my app or the console, an error is raised (no such file
> to load -- compass) saying that it couldn't load compass. Issue is not
> evident in development or production environments, only a staging
> environment.
>
> However, compass is installed. I can irb:
> require 'rubygems'
> require 'compass'
> true
>
> This is a rails 2.3.5 app. I have:
> config/compass.config
> config/initializers/compass.rb
> vendor/gems/compass/.specification
>
> I've even tried a fresh standalone app on the staging server:
> rails compass_test -mhttp://compass-style.org/rails/installer

Chris Eppstein

unread,
Apr 27, 2010, 6:01:06 PM4/27/10
to compas...@googlegroups.com
Sounds like it might be a corrupt ruby gems install. I've seen this happen more than a couple times now...

Yong Bakos

unread,
Apr 29, 2010, 6:26:53 PM4/29/10
to Compass

Ugh. This line breaks any functional tests whose views are not *.erb.

What do you mean by 'corrumpt ruby gems install'? The compass gem is
corrupt or gems is fucked?

Thanks for your input.


On Apr 27, 4:01 pm, Chris Eppstein <ch...@eppsteins.net> wrote:
> Sounds like it might be a corrupt ruby gems install. I've seen this happen
> more than a couple times now...
>
>
>
> On Tue, Apr 27, 2010 at 2:38 PM, Yong Bakos <humanorien...@gmail.com> wrote:
> > Hello,
>
> > I've a weird issue that's become difficult to troubleshoot, I wonder
> > if anyone's encountered and solved this.
>
> > When running my app or the console, an error is raised (no such file
> > to load -- compass) saying that it couldn't load compass. Issue is not
> > evident in development or production environments, only a staging
> > environment.
>
> > However, compass is installed. I can irb:
> > require 'rubygems'
> > require 'compass'
> > true
>
> > This is a rails 2.3.5 app. I have:
> > config/compass.config
> > config/initializers/compass.rb
> > vendor/gems/compass/.specification
>
> > I've even tried a fresh standalone app on the staging server:
> > rails compass_test -mhttp://compass-style.org/rails/installer
>
> > And when running script/server I do get the same error:
> > no such file to load -- compass
> > ...stacktrace...
>
> > Never had this happen w/ Compass before...
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Compass" group.
> > To post to this group, send email to compas...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > compass-user...@googlegroups.com<compass-users%2Bunsu...@googlegroups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/compass-users?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups "Compass" group.
> To post to this group, send email to compas...@googlegroups.com.
> To unsubscribe from this group, send email to compass-user...@googlegroups.com.
> For more options, visit this group athttp://groups.google.com/group/compass-users?hl=en.

Yong Bakos

unread,
Apr 29, 2010, 6:30:16 PM4/29/10
to Compass

Chris, where else have you seen this issue raised? It's a total
showstopper for us on this particular project (which sucks, since I'm
a long-time compass user).

Chris Eppstein

unread,
Apr 29, 2010, 6:31:39 PM4/29/10
to compas...@googlegroups.com
Please provide steps to reproduce and I'll look into it tonight.

Yong Bakos

unread,
Apr 29, 2010, 6:36:32 PM4/29/10
to Compass

Thanks for the offer. There are two scenarios. First, I shouldn't have
to "require 'compass'" in my environment.rb. But without it, in my
staging env, the rails app fails to load, complaining: no such file to
load -- compass.

When I _do_ add the explicit require, my functional tests fail. Simple
example is here on this thread:

http://groups.google.com/group/haml/browse_thread/thread/b1c34dbd44d0e49a

Chris Eppstein

unread,
Apr 29, 2010, 6:38:31 PM4/29/10
to compas...@googlegroups.com
Please provide the steps starting at: 1. create a new rails app.

I can't test against your app.

chris

Yong Bakos

unread,
Apr 29, 2010, 7:12:05 PM4/29/10
to Compass

I cannot replicate this issue on my local development machine, only on
staging/prod, to which I'm deploying via cap.

Below is the stacktrace. In the mean time, I'll log onto staging,
create an entirely new app there, and list the steps.

yong

[deploy@sidecar current]$ script/console staging
Loading staging environment (Rails 2.3.5)
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/
gem_dependency.rb:119:Warning: Gem::Dependency#version_requirements is
deprecated and will be removed on or after August 2010. Use
#requirement
no such file to load -- compass
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
`gem_original_require'
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
`require'
/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:158:in `require'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/
gem_dependency.rb:208:in `load'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
307:in `load_gems'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
307:in `each'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
307:in `load_gems'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
164:in `process'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
113:in `send'
/usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/initializer.rb:
113:in `run'
/apps/conference/releases/20100429230928/config/environment.rb:7
/usr/local/lib/ruby/1.8/irb/init.rb:252:in `require'
/usr/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
/usr/local/lib/ruby/1.8/irb/init.rb:250:in `each'
/usr/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules'
/usr/local/lib/ruby/1.8/irb/init.rb:21:in `setup'
/usr/local/lib/ruby/1.8/irb.rb:54:in `start'
/usr/local/bin/irb:13
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in
`gem_original_require': no such file to load -- compass
(MissingSourceFile)
from /usr/local/lib/ruby/site_ruby/1.8/rubygems/
custom_require.rb:36:in `require'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/dependencies.rb:158:in `require'
from /apps/conference/releases/20100429230928/vendor/plugins/
compass/init.rb:2:in `evaluate_init_rb'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/
plugin.rb:158:in `evaluate_init_rb'
from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.5/lib/
active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/
plugin.rb:154:in `evaluate_init_rb'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/
plugin.rb:48:in `load'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/
plugin/loader.rb:38:in `load_plugins'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/
plugin/loader.rb:37:in `each'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/rails/
plugin/loader.rb:37:in `load_plugins'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/
initializer.rb:369:in `load_plugins'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/
initializer.rb:165:in `process'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/
initializer.rb:113:in `send'
from /usr/local/lib/ruby/gems/1.8/gems/rails-2.3.5/lib/
initializer.rb:113:in `run'
from /apps/conference/releases/20100429230928/config/
environment.rb:7
from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `require'
from /usr/local/lib/ruby/1.8/irb/init.rb:252:in `load_modules'
from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `each'
from /usr/local/lib/ruby/1.8/irb/init.rb:250:in `load_modules'
from /usr/local/lib/ruby/1.8/irb/init.rb:21:in `setup'
from /usr/local/lib/ruby/1.8/irb.rb:54:in `start'
from /usr/local/bin/irb:13

Chris Eppstein

unread,
Apr 29, 2010, 7:16:36 PM4/29/10
to compas...@googlegroups.com
Have you tried uninstalling and reinstalling compass?

Chris Eppstein

unread,
Apr 29, 2010, 7:17:26 PM4/29/10
to compas...@googlegroups.com
Also, you don't need any runtime dependency on sass or compass... They can and should be precompiled for deployment.

chris

Yong Bakos

unread,
Apr 29, 2010, 7:48:25 PM4/29/10
to Compass

All right, after licking a few yak butts I found the issue.

After running the command:

rake rails:template LOCATION=http://compass-style.org/rails/installer

My application has the following:
vendor
/gems
/compass-0.8.17
/plugins
/compass
/init.rb
/haml
/init.rb

Note that the directory gems/compass-0.8.17 is empty. After removing
that directory, the app works correctly.

Now my question is, what's up with that vendor/gems directory that got
created? What is it? Why is it empty? Why did my app take a shit
because of it?

Thanks for your input.

Yong Bakos

unread,
Apr 29, 2010, 7:52:03 PM4/29/10
to Compass

Actually, there was one file in gems/compass-0.8.17, .specification.

Chris Eppstein

unread,
Apr 29, 2010, 7:53:49 PM4/29/10
to compas...@googlegroups.com
I don't know. What version of rails are you running again?

Aldo Escudero

unread,
Apr 30, 2010, 12:19:25 AM4/30/10
to compas...@googlegroups.com
Sorry to interrupt this conversation. Have you tried updating rubygems?. That solved my problem a couple of weeks ago.

Aldo Escudero


2010/4/29 Chris Eppstein <ch...@eppsteins.net>

Yong Bakos

unread,
Apr 30, 2010, 9:31:11 AM4/30/10
to Compass

I'm using Rails 2.3.5, gem version 1.3.6.

Tried uninstalling and reinstalling compass.

Let me boil this down to a couple questions. First, why is there a
need to unpack the gem into the rails app? Is this required in order
to use compass?

When running the 'installer' script for a rails app, why do you need
write permissions to the gem directory? For example, when running the
installer without sudo, I always see the following output:

rake gems:unpack GEM=compass
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /usr/local/lib/ruby/gems/
1.8 directory.


Thanks for reading.

Chris Eppstein

unread,
Apr 30, 2010, 9:41:09 AM4/30/10
to compas...@googlegroups.com
Many users like to unpack the compass gem because that helps them browse the source code easier. This is mostly to workaround the lack of documentation which won't be much of an issue soon (see http://compass-style.org/docs/).

You need sudo access to install gems into your system gem repo, without sudo, it will go into your local gem repo. The error you get now is because once you've installed a gem into the system repo, gem wants you to update/re-install it in the same location.

chris

Andrés gutiérrez

unread,
Apr 30, 2010, 9:43:01 AM4/30/10
to compas...@googlegroups.com
/usr/local/lib/ruby/gems/1.8

This isn't your user directory. Is a directory that you share with all the users that are in your machine. For this reason SUDO is needed

you can do:
sudo gem uninstall compass    ------------> (which version do you have?)

then:
sudo gem install compass --pre


2010/4/30 Yong Bakos <humano...@gmail.com>

Yong Bakos

unread,
May 3, 2010, 10:49:03 AM5/3/10
to Compass

Sorry, but you guys are misunderstanding my question. I know what sudo
is, and the relationship to installing gems.

What I'm asking is, why does the compass installer template attempt to
unpack the compass gem into my rails app when it's not necessary? If
it is necessary, then why?

Chris Eppstein

unread,
May 3, 2010, 10:56:32 AM5/3/10
to compas...@googlegroups.com
I answered both of these questions in my previous reply.

chris
Reply all
Reply to author
Forward
0 new messages