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 compile .sasss-cache file full path length over 255 will failed #1791

Open
kkbruce opened this issue Aug 25, 2014 · 16 comments
Open

Comments

@kkbruce
Copy link

kkbruce commented Aug 25, 2014

Hi,

I install RubyInstaller Ruby 2.0.0-p481 (x64) and install Compass:

C:\Users\Bruce>compass -v
Compass 1.0.1 (Polaris)

I use Compass in Sublime Text 3 - Compass build system ( https://github.com/whatwedo/Sublime-Text-2-Compass-Build-System )

Compass build System command path is : C:\Users{username}\AppData\Roaming\Sublime Text 3\Packages\Compass, It's long. It's call "compass compile '%fileDir%' --boring" from build.cmd command.

If .sass-cache file full path over 255 words will failed, like this:

C:\Users\Bruce\AppData\Roaming\Sublime Text 3\Packages\Compass>compass compile 'E:\cpproject' --boring
error E:/cpproject/sass/test.scss (C:/Ruby200-x64/lib/ruby/2.0.0/tempfile.rb:146:in `initialize': No such file or directory - C:/Users/Bruce/AppData/Roaming/Sublime Text 3/Packages/Compass/.sass-cache/75fcaf1b4852ceb732871195e41567cc2a7
d8997/C%058%092Ruby200-x64%092lib%092ruby%092gems%0922.0.0%092gems%092compass-core-1.0.1%092stylesheets%092compass%092_s
upport.scssc20140825-5800-ni3jly
)
Compilation failed in 1 files.

Path length is 262.

If .sass-cache file full path less 255 words, compile will succeed.

This is trace infomation:

C:\Users\Bruce\AppData\Roaming\Sublime Text 3\Packages\Compass>compass compile 'E:\cpproject' --trace
write E:/cpproject/stylesheets/ie.css
Errno::ENOENT on line ["146"] of C: No such file or directory - C:/Users/Bruce/AppData/Roaming/Sublime Text 3/Packages/C
ompass/.sass-cache/75fcaf1b4852ceb732871195e41567cc2a7d8997/C%058%092Ruby200-x64%092lib%092ruby%092gems%0922.0.0%092gems
%092compass-core-1.0.1%092stylesheets%092compass%092_support.scssc20140825-1356-1sd988d
C:/Ruby200-x64/lib/ruby/2.0.0/tempfile.rb:146:in 'open'
C:/Ruby200-x64/lib/ruby/2.0.0/tempfile.rb:146:in 'block in initialize'
C:/Ruby200-x64/lib/ruby/2.0.0/tmpdir.rb:142:in 'create'
C:/Ruby200-x64/lib/ruby/2.0.0/tempfile.rb:136:in 'initialize'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/util.rb:1193:in 'new'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/util.rb:1193:in 'atomic_create_and_write_file'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/cache_stores/filesystem.rb:39:in '_store'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/cache_stores/base.rb:51:in 'store'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/cache_stores/chain.rb:19:in 'block in store'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/cache_stores/chain.rb:19:in 'each'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/cache_stores/chain.rb:19:in 'store'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/engine.rb:404:in '_to_tree'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/engine.rb:299:in 'to_tree'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/plugin/staleness_checker.rb:178:in 'block in compute_depen
dencies'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/tree/node.rb:193:in 'block (2 levels) in each'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/tree/node.rb:192:in 'each'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/tree/node.rb:193:in 'block in each'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/tree/node.rb:193:in 'each'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/tree/node.rb:193:in 'each'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/plugin/staleness_checker.rb:174:in 'grep'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/plugin/staleness_checker.rb:174:in 'compute_dependencies'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/plugin/staleness_checker.rb:149:in 'dependencies'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/plugin/staleness_checker.rb:125:in 'dependencies_stale?'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/plugin/staleness_checker.rb:166:in 'block in dependency_up
dated?'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/plugin/staleness_checker.rb:125:in 'each'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/plugin/staleness_checker.rb:125:in 'any?'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/plugin/staleness_checker.rb:125:in 'dependencies_stale?'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/plugin/staleness_checker.rb:166:in 'block in dependency_up
dated?'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/plugin/staleness_checker.rb:125:in 'each'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/plugin/staleness_checker.rb:125:in 'any?'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/plugin/staleness_checker.rb:125:in 'dependencies_stale?'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/plugin/staleness_checker.rb:166:in 'block in dependency_up
dated?'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/plugin/staleness_checker.rb:81:in 'call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/plugin/staleness_checker.rb:81:in 'stylesheet_modified_sin
ce?'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/plugin/staleness_checker.rb:69:in 'stylesheet_needs_update
?'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/plugin/compiler.rb:211:in 'block in update_stylesheets'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/plugin/compiler.rb:209:in 'each'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.4.1/lib/sass/plugin/compiler.rb:209:in 'update_stylesheets'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-1.0.1/lib/compass/sass_compiler.rb:40:in 'compile!'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-1.0.1/lib/compass/commands/update_project.rb:49:in 'perform'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-1.0.1/lib/compass/commands/base.rb:18:in 'execute'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-1.0.1/lib/compass/commands/project_base.rb:19:in 'execute'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-1.0.1/lib/compass/exec/sub_command_ui.rb:43:in 'perform!'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-1.0.1/lib/compass/exec/sub_command_ui.rb:15:in 'run!'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-1.0.1/bin/compass:30:in 'block in <top (required)>'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-1.0.1/bin/compass:44:in 'call'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-1.0.1/bin/compass:44:in '<top (required)>'
C:/Ruby200-x64/bin/compass:23:in 'load'
C:/Ruby200-x64/bin/compass:23:in '<main>'

Thanks

@Shupal
Copy link

Shupal commented Aug 26, 2014

maybe it is the same problem #1642

@kkbruce
Copy link
Author

kkbruce commented Aug 26, 2014

  1. @deeja step is work for my Windows 8.1.
  2. Should be the same problem. Thanks @Shupal .

@kkbruce
Copy link
Author

kkbruce commented Aug 27, 2014

Follow steps:

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

gem install sass -v 3.2.14 
gem install compass -v 0.12.3 
gem install compass-import-once -v 1.0.3

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

gem install compass

Now, compass -v output 1.0.1, sass -v output 3.4.1.

compile output .sass-cache/75fcaf1b4852ceb732871195e41567cc2a7
d8997/C%058%092Ruby200-x64%092lib%092ruby%092gems%0922.0.0%092gems%092compass-core-1.0.1%092stylesheets%092compass%092_support.scssc20140825-5800-ni3jly will change {your scss name}.scssc, It let compile succeed for Sublime Text - Compass.

I don't know why, have a magic?

@Shupal
Copy link

Shupal commented Aug 27, 2014

Do you need the newest sass version?
Cause if you uninstall the current compass version, then install a older version, then uninstall the old version and install it via "gem install compass" your get the newest compass/sass version with the bad behaviour ;-)

just do

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

gem install sass -v 3.2.14
gem install compass -v 0.12.3
gem install compass-import-once -v 1.0.3

and via compass watch in the folder everything works on a windows machine.

@kkbruce
Copy link
Author

kkbruce commented Aug 27, 2014

@Shupal Thank your replay :D

@novascreen
Copy link

i'm still having this problem on Windows 7, i don't have the option to use the older version.
is there any other workaround or fix in sight?

@FlyingDR
Copy link

@novascreen Since problem itself is about too long paths generated by Compass - it maybe helpful to move your .sass-cache somewhere closer to root path. It can be done for example by using Bundler to get local copy of Compass in your project and move project itself somewhere in root of the disk.

I use Bundler in my projects (on Windows 7) with Compass 1.0.1 and SASS 3.4 and my cache paths looks like d:\web\projects\test\scss\.sass-cache\0a024e9da9e72b0b9ee5bc6dcb0cbc28dca6b8fa\_triple.scssc
Gemfile file contents:

source "https://rubygems.org"

gem "sass", "~> 3.4.0"
gem "compass", "~> 1.0.0"
gem "oily_png", "~> 1.1.0"
gem "breakpoint", "~> 2.5.0"
gem "susy", "~> 2.1.0"
gem "autoprefixer-rails", "~> 3"
gem "csso-rails", "~> 0.3" 

Local configuration for Bundler in .bundle\config:

---
BUNDLE_PATH: gems
BUNDLE_DISABLE_SHARED_GEMS: '1' 

Compilation is called from command line as bundle exec compass compile --force -e production

Hope it will help somehow :)

@rask
Copy link

rask commented Oct 15, 2014

Verified. On Windows 7 with latest Compass and dependencies I changed cache_path in config.rb to C:\temp\sass\ from E:\very\long\directory\structure\to\a\distant\project\directory\.sass-cache and the error disappeared.

@sambody
Copy link

sambody commented Nov 21, 2014

Thanks @rask. That worked for me too.

@gaffleck
Copy link

Had the same problem. solved it by modifying config.rb. Added: cache_path = "c:\temp\sass" solved it

@heshhassan
Copy link

I just re-installed compass and it works fine now
gem install compass

CarbonBasedDudeform added a commit to CarbonBasedDudeform/VeggieRecipes that referenced this issue Oct 11, 2015
Had to revert to previous version of compass to fix error when importing css3
from compass.

Fix found at: Compass/compass#1791

Other than that, updated the scss for the recipes on the main page.
Currently experimenting with border-radius on the recipes.
Currently overusing them, doesn't look too nice, but I'm not sure what to do
with them.
@AnasAl-tamemy
Copy link

@HeshamElghndour the issue still open, so it is useless to reinstall the sass
@rask. Thanks, You are a life saver.

@sknightq
Copy link

@rask THX! You ara my god. Solve it.

@rask
Copy link

rask commented Jun 23, 2016

From what I've learned this error happens because Windows Win32 file system API limits the maximum path length internally to around 255 characters. There is nothing applications can do other than bypass the restrictions by choosing shorter folder/file names.

The same issue kept happening with NodeJS's npm v2, where the node_modules directory could go hundreds of directories deep, which resulted in the same problem as presented in this issue. npm v3 fixed this by using a flatter node_modules structure.

The Win32 API truncates all file paths to the ~255 character limit, resulting in missing file/folder errors even though the actual files are there and browsable in software that does not rely on the said Win32 API.

@PhilipAbbott
Copy link

Just to note, I am on Windows 10 Ruby 2.4.0 and I needed to escape my slashes in config.rb
cache_path = "C:\\temp\\sass"

@Fokrychel
Copy link

Fokrychel commented Mar 20, 2019

it works!! oh my god! THXS ,@rask

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests