"Errno::EACCESS...permission denied" running compass watch

29,307

Solution 1

To get it to work in 32 or 64bit windows, I done what Min Ren suggested but I also had to manually clean the gem repository (C:\Users\myusername\.gem\specs\rubygems.org%443\quick\Marshal.4.8) of all the sass and compass gemspec files after the uninstall steps. I also installed sass before compass.

gem uninstall compass
gem uninstall sass

manually clean .gem

gem install sass --version "3.2.10"
gem install compass --version "0.12.2" 

Solution 2

I was having this same issue for a while and eventually fixed it manually. After some digging, the issue appears to be that in util.rb, the temp file is being renamed before the file is closed. In Windows, this apparently isn't permitted (although not sure why I suddenly started getting the problem after it had been working on the past).

The fix for me was to edit util.rb (PATH_TO_RUBY\lib\ruby\gems\1.9.1\gems\sass-3.2.18\lib\sass\util.rb). I copied the line closing the temp file to before the permission change + rename on line 897. Here is the updated function as I now have it:

def atomic_create_and_write_file(filename, perms = 0666)
      require 'tempfile'
      tmpfile = Tempfile.new(File.basename(filename), File.dirname(filename))
      tmpfile.binmode if tmpfile.respond_to?(:binmode)
      result = yield tmpfile
      tmpfile.flush # ensure all writes are flushed to the OS
      begin
        tmpfile.fsync # ensure all buffered data in the OS is sync'd to disk.
      rescue NotImplementedError
        # Not all OSes support fsync
      end
      tmpfile.close if tmpfile
      # Make file readable and writeable to all but respect umask (usually 022).
      File.chmod(perms & ~File.umask, tmpfile.path)
      File.rename tmpfile.path, filename
      result
    ensure
      # close and remove the tempfile if it still exists,
      # presumably due to an error during write
      tmpfile.close if tmpfile
      tmpfile.unlink if tmpfile
    end

One big caveat here is that I'm not a Ruby person and I'm sure there is probably a better way. But I just tried this mod quickly, and it worked, so I didn't put more into it.

Solution 3

Looks like issue is solved in SASS 3.2.19

so all you need is gem update compass

Solution 4

It looks like a bug in the newest version of Sass.

Uninstalling Sass and Compass and installing the older versions fixes the issue.

There might be newer versions that do work, but here's what I've tested and know works.

gem uninstall compass
gem uninstall sass

gem install compass -v "0.12.2"
gem install sass -v "3.2.13"

Solution 5

I was getting a similar error, but had a completely different resolution, so I thought it was worth sharing in case anyone else runs into my scenario.

I was actually getting permission denied because my source control had made my .css files read-only. The solution was simple enough, just check out the css files and everything went back to normal.

Share:
29,307
Sheixt
Author by

Sheixt

Updated on April 15, 2020

Comments

  • Sheixt
    Sheixt about 4 years

    I just migrated my project files onto a new PC on the D: drive whilst my programs (Git, Node Js, Ruby, etc) are on the C: drive.

    I have tried to run compass watch after editing a SASS file, but encounter this error:

    Errno::EACCES on line ["897"] of C: Permission denied - <D:/project_dir/stylesheets/app.css20140323-10532-gziux, D:/project_dir/stylesheets/app.css>
    Run with --trace to see the full backtrace
    

    I'm a novice with Ruby at the command line (as I only use it for web development purposes). What do I need to do to allow the permissions?

    Please let me know if I can provide more information.

    EDIT: Here's what was returned after running compass watch --trace:

    D:\project_dir>compass watch --trace
    >>> Change detected at 21:53:53 to: app.scss
    overwrite stylesheets/app.css
    Errno::EACCES on line ["897"] of C: Permission denied - (D:/project_dir/stylesheets/app.css20140323-14712-11v62k7, D:/project_dir/stylesheets/app.css)
    C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/sass-3.2.18/lib/sass/util.rb:897:in `atomic_create_and_write_file'
    C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/actions.rb:58:in `write_file'
        C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/compiler.rb:143:in `compile'
        C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/compiler.rb:118:in `compile_if_required'
        C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/compiler.rb:103:in `block (2 levels) in run'
        C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/compiler.rb:101:in `each'
        C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/compiler.rb:101:in `block in run'
        C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/compiler.rb:126:in `timed'
        C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/compiler.rb:100:in `run'
        C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/commands/watch_project.rb:147:in `recompile'
        C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/commands/watch_project.rb:68:in `perform'
        C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/commands/base.rb:18:in `execute'
        C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/commands/project_base.rb:19:in `execute'
        C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/exec/sub_command_ui.rb:43:in `perform!'
        C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/lib/compass/exec/sub_command_ui.rb:15:in `run!'
        C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/bin/compass:30:in `block in <top (required)>'
        C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/bin/compass:44:in `call'
        C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/compass-0.12.4/bin/compass:44:in `<top (required)>'
        C:/Ruby200-x64/bin/compass:23:in `load'
        C:/Ruby200-x64/bin/compass:23:in `<main>'
    >>> Compass is polling for changes. Press Ctrl-C to Stop.
    

    I don't know what to make from that though.

    From doing some reading (https://github.com/chriseppstein/compass/issues/1406) I believe it's something to do with the permissions or PATH for 'Ruby' & 'Ruby Gems' but I don't know what to do to resolve this.

  • Sheixt
    Sheixt about 10 years
    I've tried to do this and I get somewhere... but I get a LOAD of depreciation warnings in the 'Foundation' .scss file. The main problem is it returns LoadError on line ['55'] of C: cannot load such file -- wdm
  • Mark Hazlewood
    Mark Hazlewood about 10 years
    I tried the whole clean/reinstall process several times with various versions of Ruby, etc. It never worked for me. What eventually worked was what I posted in my answer.
  • Klikerko
    Klikerko about 10 years
    @user3455260 As courtesy, next time you copy/paste the answer from other user at least give them some credit, or link to it.
  • Sheixt
    Sheixt about 10 years
    I managed to get this working in the end by doing various uninstalls & re-installations of both the SASS & Compass gems. Had to use the versions mentioned in this (& Min Ren's) answer. Wonder when the bug will be resolved for the newer version of SASS. Thanks for your help all.
  • EmileKumfa
    EmileKumfa about 10 years
    Thanks it helped me out
  • Tony O'Hagan
    Tony O'Hagan about 10 years
    Worked for me. Thanks!
  • Razor
    Razor over 9 years
    issue still present with sass-3.4.5
  • crmpicco
    crmpicco almost 9 years
    What OS are you running this on? This didn't work for me on CentOS 7.
  • pangpang
    pangpang over 8 years
    This does not really answer the question. If you have a different question, you can ask it by clicking Ask Question. You can also add a bounty to draw more attention to this question once you have enough reputation.
  • Wake
    Wake over 8 years
    @pangpang it does answer the question. If you think otherwise, please explain why you think so.
  • Tania Rascia
    Tania Rascia over 8 years
    Don't know why you got haters - this was my exact issue! Somehow, updating to El Capitan changes the permissions on my folders. Thanks a bunch!