Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compass-import-once causes `compass compile` to fail on Windows since 1.0.4 #1642

Open
andypearson opened this issue Apr 10, 2014 · 23 comments

Comments

Projects
None yet
@andypearson
Copy link

commented Apr 10, 2014

We've just had a lot of fun trying to debug this over the past few hours...

The crux of the issues is:

On OS X the generated output cache path for an import-once scss file looks like:
75fcaf1b4852ceb732871195e41567cc2a7d8997//Library/Ruby/Gems/2.0.0/gems/compass-0.12.3/frameworks/compass/stylesheets/compass/layout/_grid-background.scssc

On Windows it'll look like:
75fcaf1b4852ceb732871195e41567cc2a7d8997/C:/RUBY193/lib/ ruby/gems/1.9.1/gems/compass-0.12.2/frameworks/compass/stylesheets/compass

When it comes to creating the cache file that C: is the problem - it'll cause Windows to bail out with an Errno::ENOENT error, whilst Unix is happy to go ahead and create the file despite the fact it'll be several directories deep.

The problem seems to come for the following method, in 1.0.3 it looked like:

def key(uri, options, *args)
  if uri =~ /^\(NOT IMPORTED\)/
    ["(import-once)", "dummy_engine"]
  else
    super
  end
end

And in 1.0.4 it looks like:

def key(uri, options, *args)
  if uri =~ /^\(NOT IMPORTED\) (.*)$/
    ["(import-once)", $1]
  else
    super
  end
end

It looks like a relatively simple fix; massage $1 a little bit to remove the project path before giving it back to sass. Thoughts?

Here is a screenshot showing roughly what is going on, grabbed hastily from @deeja's machine.

screeenshot-edit

@clauzf

This comment has been minimized.

Copy link

commented Apr 11, 2014

thanks you for this post, after read your post, I fixed it by replace the "key" function with the old version one.

@frxnz

This comment has been minimized.

Copy link

commented Apr 11, 2014

This looks like the same issue I'm having in #1640

@andypearson

This comment has been minimized.

Copy link
Author

commented Apr 14, 2014

@frxnz Yup, that does indeed look like the same issue.

@deeja

This comment has been minimized.

Copy link

commented Apr 23, 2014

Might mention that the file affected on my machine is:
C:\Ruby193\lib\ruby\gems\1.9.1\gems\compass-import-once-1.0.3\lib\compass\import-once\importer.rb

@nickjules

This comment has been minimized.

Copy link

commented May 19, 2014

I have exactly the same problem, but I am a designer and am really struggling
with the techy side, here is the error and the gems I have in a gem file, please could someone advise ( as if speaking to a child might help with my skill level!) Many thanks

error1

error_gems

@nickjules

This comment has been minimized.

Copy link

commented May 19, 2014

sorry to have posted the above, all I needed was @import "compass/css3"; and then it compiled without error. I am so new to all this.......

@ymcheung

This comment has been minimized.

Copy link

commented Jul 28, 2014

I've got the same problem but dunno how to solve it.
Do the same as @deeja 's screenshot?

@deeja

This comment has been minimized.

Copy link

commented Jul 28, 2014

If you don't mind what version you use, you can roll back a bit to where it works:

call gem uninstall compass-import-once -a
call gem uninstall compass -a
call gem uninstall sass -a

call gem install sass -v 3.2.14 
call gem install compass -v 0.12.3 
call gem install compass-import-once -v 1.0.3
@ymcheung

This comment has been minimized.

Copy link

commented Jul 29, 2014

My colleagues use susy2 so that I have to install at least sass v3.3 and compass 1.0.
Can I just install compass-import-once 1.0.3 ?

@chriseppstein

This comment has been minimized.

Copy link
Member

commented Aug 18, 2014

I've rewritten the compass compiler to use Sass's internal compiler and there's been an import once update since then. Can you verify this is fixed in 1.0?

@AirQuick

This comment has been minimized.

Copy link

commented Aug 19, 2014

It depends on the path length. Steps to repro:

  1. Install Ruby, Sass and Compass in "p:\Ruby\test1".
  2. Create an empty directory: "p:\proj"
  3. In "p:\proj", run "compass create".
  4. Insert a '@import "compass";' line into "p:\proj\sass\screen.scss".
  5. Run "compass compile --force" in "p:\proj". => Success
  6. Rename the Ruby installation directory to a longer one: "p:\Ruby\test123456789012345678901234567890"
  7. Run "compass compile --force" in "p:\proj". => Fail

error sass/screen.scss (P:/Ruby/test123456789012345678901234567890/lib/ruby/
2.0.0/tempfile.rb:146:in `initialize': No such file or directory - p:/proj/.sass
-cache/75fcaf1b4852ceb732871195e41567cc2a7d8997/P%058%092Ruby%092test12345678901
2345678901234567890%092lib%092ruby%092gems%0922.0.0%092gems%092compass-core-1.0.
0%092stylesheets%092compass%092utilities%092general%092_hacks.scssc20140819-1077
2-1viz04c)
Compilation failed in 1 files.

Ruby 2.0.0 451 x64
Sass 3.4.0 (Selective Steve)
Compass 1.0.0 (Polaris)

Seems like the current naming convention goes easily beyond MAX_PATH?

@chriseppstein chriseppstein reopened this Aug 19, 2014

@JustJenFelice

This comment has been minimized.

Copy link

commented Aug 21, 2014

I think I've got much of the same here:

Errno::ENOENT on line ["50"] of /Users/username/.rvm/gems/ruby-2.1.1@project/gems/listen-2.7.9/lib/listen/listener.rb: No such file or directory @ realpath_rec - /sass

Compass 1.0.1 (Polaris)
Sass 3.4.0 (Selective Steve)
Ruby-2.1.1
on Mac OSX 10.9.4

Here's the full backtrace:

Errno::ENOENT on line ["50"] of /Users/username/.rvm/gems/ruby-2.1.1@project/gems/listen-2.7.9/lib/listen/listener.rb: No such file or directory @ realpath_rec - /sass
  /Users/username/.rvm/gems/ruby-2.1.1@project/gems/listen-2.7.9/lib/listen/listener.rb:50:in `realpath'
  /Users/username/.rvm/gems/ruby-2.1.1@project/gems/listen-2.7.9/lib/listen/listener.rb:50:in `block in initialize'
  /Users/username/.rvm/gems/ruby-2.1.1@project/gems/listen-2.7.9/lib/listen/listener.rb:50:in `map'
  /Users/username/.rvm/gems/ruby-2.1.1@project/gems/listen-2.7.9/lib/listen/listener.rb:50:in `initialize'
  /Users/username/.rvm/gems/ruby-2.1.1@project/gems/listen-2.7.9/lib/listen.rb:70:in `new'
  /Users/username/.rvm/gems/ruby-2.1.1@project/gems/listen-2.7.9/lib/listen.rb:70:in `_add_listener'
  /Users/username/.rvm/gems/ruby-2.1.1@project/gems/listen-2.7.9/lib/listen.rb:27:in `to'
  /Users/username/.rvm/gems/ruby-2.1.1@project/gems/sass-3.4.0/lib/sass/plugin/compiler.rb:389:in `block in create_listener'
  /Users/username/.rvm/gems/ruby-2.1.1@project/gems/sass-3.4.0/lib/sass/plugin/compiler.rb:388:in `map'
  /Users/username/.rvm/gems/ruby-2.1.1@project/gems/sass-3.4.0/lib/sass/plugin/compiler.rb:388:in `create_listener'
  /Users/username/.rvm/gems/ruby-2.1.1@project/gems/sass-3.4.0/lib/sass/plugin/compiler.rb:323:in `watch'
  /Users/username/.rvm/gems/ruby-2.1.1@project/gems/compass-1.0.1/lib/compass/sass_compiler.rb:46:in `watch!'
  /Users/username/.rvm/gems/ruby-2.1.1@project/gems/compass-1.0.1/lib/compass/commands/watch_project.rb:41:in `perform'
  /Users/username/.rvm/gems/ruby-2.1.1@project/gems/compass-1.0.1/lib/compass/commands/base.rb:18:in `execute'
  /Users/username/.rvm/gems/ruby-2.1.1@project/gems/compass-1.0.1/lib/compass/commands/project_base.rb:19:in `execute'
  /Users/username/.rvm/gems/ruby-2.1.1@project/gems/compass-1.0.1/lib/compass/exec/sub_command_ui.rb:43:in `perform!'
  /Users/username/.rvm/gems/ruby-2.1.1@project/gems/compass-1.0.1/lib/compass/exec/sub_command_ui.rb:15:in `run!'
  /Users/username/.rvm/gems/ruby-2.1.1@project/gems/compass-1.0.1/bin/compass:30:in `block in <top (required)>'
  /Users/username/.rvm/gems/ruby-2.1.1@project/gems/compass-1.0.1/bin/compass:44:in `call'
  /Users/username/.rvm/gems/ruby-2.1.1@project/gems/compass-1.0.1/bin/compass:44:in `<top (required)>'
  /Users/username/.rvm/gems/ruby-2.1.1@project/bin/compass:23:in `load'
  /Users/username/.rvm/gems/ruby-2.1.1@project/bin/compass:23:in `<main>'
  /Users/username/.rvm/gems/ruby-2.1.1@global/bin/ruby_executable_hooks:15:in `eval'
  /Users/username/.rvm/gems/ruby-2.1.1@global/bin/ruby_executable_hooks:15:in `<main>'

I've been wrangling with this ever since I updated Compass and am now resorting to rolling-back. If anybody has any other suggestions for a possible fix, I'd love to hear it.

@ancientrs

This comment has been minimized.

Copy link

commented Aug 21, 2014

I solved this issue with @andypearson 's way, that I replace the "key" function with the old version(1.0.3) on Windows. Thanks a lot.

@JustJenFelice

This comment has been minimized.

Copy link

commented Aug 21, 2014

@ancientrs - thanks! I just rolled back and managed to get things working again. There does seem to be some significant differences in how the versions compile (as previously mentioned)...maybe it has to do with the handling of project_path. No sure yet. Regardless, I'm up and running again for now. Many thanks 👍

@bidah

This comment has been minimized.

Copy link

commented Aug 25, 2014

It worked for me after @deeja 's way. Thanks

@Shupal

This comment has been minimized.

Copy link

commented Aug 26, 2014

thanks @deeja
now it works!

@kkbruce

This comment has been minimized.

Copy link

commented Aug 26, 2014

@Shupal
My OS is Windows 8.1, @deeja steps is works for me.

@pdrosos

This comment has been minimized.

Copy link

commented Sep 5, 2014

Same issue here on Windows 7. It seems that we also have the problem with the long paths.
For now we downgraded as proposed above and the problem is gone, but we would like to use the latest version. When and in which of the next versions could we expect a fix of this issue?

Thanks.

@ghost

This comment has been minimized.

Copy link

commented Oct 8, 2014

@andypearson, thank you! You helped me greatly!

@Frikki

This comment has been minimized.

Copy link

commented Oct 13, 2014

Thank you, @deeja and @andypearson

@sambody

This comment has been minimized.

Copy link

commented Nov 21, 2014

I solved it using a solution suggested in issue #1791.
Just setting
cache = true
cache_path = 'C:/temp/sass/'
I didn't have to uninstall anything.

@jhoaquinsito

This comment has been minimized.

Copy link

commented Nov 25, 2014

Thanks @sambody . I've set cache and cache_path and everything works fine without downgrade.

@ngadiono

This comment has been minimized.

Copy link

commented May 4, 2016

Thanks @sambody you safe my life haha, it worked!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.