SassDoc / sassdoc

Release the docs!
http://sassdoc.com
MIT License
1.41k stars 56 forks source link

Error when unlinking main.css on Windows 10 #493

Closed CMessinides closed 7 years ago

CMessinides commented 7 years ago

This error only shows up when Sassdoc has run once before with the same destination folder. Sassdoc parses the source files successfully, then hangs and finally exits with an error when it tries to clean out the destination folder. I'm using Sassdoc through Gulp, but I replicated the issue with the CLI as well. The stack trace for the Gulp task is below:

$ gulp docs
[00:26:02] Using gulpfile ~\Libraries\spacesuit\gulpfile.js
[00:26:02] Starting 'docs'...
[00:26:05] Finished 'docs' after 2.64 s
» Sass sources successfully parsed.
» [ERROR] EPERM: operation not permitted, unlink 'C:\Users\Cameron Messinides\Libraries\spacesuit\docs\assets\css\main.css'
(node:12228) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): SassDocError: EPERM: operation not permitted, unlink 'C:\Users\Cameron Messinides\Libraries\spacesuit\docs\assets\css\main.css'
(node:12228) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): SassDocError: EPERM: operation not permitted, unlink 'C:\Users\Cameron Messinides\Libraries\spacesuit\docs\assets\css\main.css'

This is the task in my Gulpfile:

gulp.task('docs', function() {
  return gulp.src(sassPath)
      .pipe(sassdoc({
        dest: 'docs',
        verbose: true
      }))
})

After exiting with this error, the main.css file remains almost like a phantom file: Attempts to delete it with the Windows Explorer GUI and three different shells (Command Prompt, Git Bash, Ubuntu Bash on Windows), all with root permissions, fail due to insufficient permissions. Only after a full system restart can the file be deleted.

This error is making Sassdoc virtually unusable on Windows, barring a system restart every time I want to update the docs. I appreciate any fixes or help. Thanks for your work!

pascalduez commented 7 years ago

Hi,

that's sound quite worrying. But before anything, your setup looks quite confusing, you set the source folder as the destination folder, can't you just scope things a little more? We have safeguards for such cases, but still.

CMessinides commented 7 years ago

Sorry, I'm not sure I understand what you mean by scoping things. The Gulp source is scss/**/*.scss (which I abstracted behind the variable sassPath because I use it elsewhere) and the destination folder is docs, which gives me a project directory like so:

┆
┝━ scss         // my Sass source files are here
│    ┝━ _base.scss
│    ┝━ _config.scss
┆
┝━ docs        // all the Sassdoc-generated files show up here
│    ┝━ assets
│    ┝━ index.html
┆

My Gulp setup is essentially what the documentation suggests in the Sassdoc documentation. Please correct me if I've misunderstood you, but my source folder and destination folder are not the same. Sorry for the confusion.

EDIT: Here's a screenshot of the actual project directory:

A screenshot of my project directory
pascalduez commented 7 years ago

@CMessinides Sorry, I completely misread your code sample, confused the task name with the src... Thanks for the detailed explanation.
So this is even more worrying then :)

Our main issue here is we will need to find a Window$ machine/vm to be able to debug, also motivation. Any help welcome.

Some pointers: https://github.com/SassDoc/sassdoc/blob/master/src/sassdoc.js#L86-L104
https://github.com/themeleon/safe-wipe

CMessinides commented 7 years ago

And now to totally confuse the issue: The problem seems to have gone away entirely. I suspect, then, that this may just be some corner case on my machine, maybe some interaction between software. I did a little digging and found people with error messages (not from Sassdoc but from other Node tools), and the problem stemmed from their anti-virus programs of all things.

Thank you for your help with this issue all the same, @pascalduez. Unless someone else reports similar error messages, I think this is probably just an inconsistency on my machine.

pascalduez commented 7 years ago

@CMessinides All right, keep us posted if you get to know more, hopefully not ;)