"Errno :: EACCESS ......许可否认"正在运行罗盘手表

She*_*ixt 13 ruby windows sass compass-sass

我只是将我的项目文件迁移到D:驱动器上的新PC上,而我的程序(Git,Node Js,Ruby等)在C:驱动器上.

compass watch在编辑SASS文件后尝试运行,但遇到此错误:

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
Run Code Online (Sandbox Code Playgroud)

我在命令行使用Ruby是一个新手(因为我只将它用于Web开发目的).我需要做什么才能允许权限?

如果我能提供更多信息,请告诉我.

编辑:这是运行后返回的内容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.
Run Code Online (Sandbox Code Playgroud)

我不知道该怎么做.

从做一些阅读(https://github.com/chriseppstein/compass/issues/1406)我相信它与'Ruby'和'Ruby Gems'的权限或PATH有关,但我不知道该怎么做解决这个问题.

小智 36

为了让它在32或64位窗口中工作,我做了Min Ren建议的,但是我还必须C:\Users\myusername\.gem\specs\rubygems.org%443\quick\Marshal.4.8在卸载步骤之后手动清理所有sass和指南针gemspec文件的gem repository().我还在指南针之前安装了sass.

gem uninstall compass
gem uninstall sass
Run Code Online (Sandbox Code Playgroud)

手动清理.gem

gem install sass --version "3.2.10"
gem install compass --version "0.12.2" 
Run Code Online (Sandbox Code Playgroud)


Mar*_*ood 9

我有一段时间遇到同样的问题并最终手动修复它.经过一番挖掘,问题似乎是在util.rb中,临时文件在文件关闭之前被重命名.在Windows中,这显然是不允许的(虽然不确定为什么我在过去工作后突然开始解决问题).

我的修复是编辑util.rb(PATH_TO_RUBY\lib\ruby​​\gems\1.9.1\gems\sass-3.2.18\lib\sass\util.rb).我将关闭临时文件的行复制到第897行的权限更改+重命名之前.这是我现在拥有的更新函数:

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
Run Code Online (Sandbox Code Playgroud)

这里有一个重要的警告是我不是一个Ruby人,我敢肯定可能有更好的方法.但是我只是快速尝试了这个mod,它起作用了,所以我没有多加入它.