【问题标题】:Sass won't compile SCSS (EACCES error)Sass 不会编译 SCSS(EACCES 错误)
【发布时间】:2017-10-05 18:09:25
【问题描述】:

我正在尝试编译我的 SCSS 文件,但我总是收到此错误。这是新功能,因为在 Windows 10 Creator Update 之前它运行良好。

这是错误:

$ sass --no-cache --update --trace app.scss:app.css
    c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/plugin/compiler.rb:516:in `initialize': Permission denied @ rb_sysopen - appp.css (Errno::EACCES)
            from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/plugin/compiler.rb:516:in `open'
            from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/plugin/compiler.rb:516:in `write_file'
            from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/plugin/compiler.rb:503:in `update_stylesheet'
            from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/plugin/compiler.rb:215:in `block in update_stylesheets'
            from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/plugin/compiler.rb:209:in `each'
            from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/plugin/compiler.rb:209:in `update_stylesheets'
            from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/plugin.rb:82:in `update_stylesheets'
            from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/exec/sass_scss.rb:340:in `watch_or_update'
            from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/exec/sass_scss.rb:51:in `process_result'
            from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/exec/base.rb:52:in `parse'
            from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/lib/sass/exec/base.rb:19:in `parse!'
            from c:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/sass-3.4.25/bin/sass:13:in `<top (required)>'
            from c:/Ruby24-x64/bin/sass:23:in `load'
            from c:/Ruby24-x64/bin/sass:23:in `<main>'

我检查了编译器失败的地方,这就是我得到的:

513    def write_file(fileName, content)
514      flag = 'w'
515      flag = 'wb' if Sass::Util.windows? && options[:unix_newlines]
516      File.open(fileName, flag) do |file|
517        file.set_encoding(content.encoding) unless Sass::Util.ruby1_8?
518        file.print(content)
519      end
520    end

【问题讨论】:

    标签: sass compilation rubygems


    【解决方案1】:

    刚刚发现问题。无论出于何种原因,如果文件位于带有空格的路径中,它将无法工作。我将文件夹移动到“安全地址”,它就像一个魅力。

    【讨论】: