Compass / compass

Compass is no longer actively maintained. Compass is a Stylesheet Authoring Environment that makes your website design simpler to implement and easier to maintain.
http://compass-style.org
Other
6.72k stars 1.18k forks source link

compass compile .sasss-cache file full path length over 255 will failed #1791

Open kkbruce opened 10 years ago

kkbruce commented 10 years ago

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 commented 10 years ago

maybe it is the same problem https://github.com/Compass/compass/issues/1642

kkbruce commented 10 years ago
  1. @deeja step is work for my Windows 8.1.
  2. Should be the same problem. Thanks @Shupal .
kkbruce commented 10 years ago

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 commented 10 years ago

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 commented 10 years ago

@Shupal Thank your replay :D

novascreen commented 10 years ago

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 commented 10 years ago

@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 commented 10 years ago

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 commented 9 years ago

Thanks @Rask. That worked for me too.

gaffleck commented 9 years ago

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

heshhassan commented 9 years ago

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

AnasAl-tamemy commented 8 years ago

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

sknightq commented 8 years ago

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

rask commented 8 years ago

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 commented 7 years ago

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 commented 5 years ago

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