leemunroe / grunt-email-workflow

A Grunt workflow for designing and testing responsive HTML email templates with SCSS.
MIT License
3.05k stars 339 forks source link

Fatal error in clean #77

Closed toby1kenobi closed 5 years ago

toby1kenobi commented 8 years ago

I have a weird problem I'm seeing on Windows 10. The first time I run grunt serve everything seems to be fine. Subsequently, however, it loads ok but as soon as I make a change in a template I get the following error:

Running "clean:clean" (clean) task
Fatal error: watch null EPERM
>> 1 path cleaned.
Fatal error: watch null EPERM
Fatal error: watch null EPERM
Error: ENOENT: no such file or directory, scandir 'C:\Users\Toby\Documents\projects\myproject\email-examples\dist'
  at Error (native)
  at Object.fs.readdirSync (fs.js:808:18)
  at getTemplates (C:\Users\Toby\Documents\projects\myproject\email-examples\server.js:33:28)
  at C:\Users\Toby\Documents\projects\myproject\email-examples\server.js:19:18
  at Layer.handle [as handle_request] (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\layer.js:95:5)
  at next (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\route.js:131:13)
  at Route.dispatch (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\route.js:112:3)
  at Layer.handle [as handle_request] (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\layer.js:95:5)
  at C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:277:22
  at Function.process_params (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:330:12)
  at next (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:271:10)
  at expressInit (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\middleware\init.js:33:5)
  at Layer.handle [as handle_request] (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\layer.js:95:5)
  at trim_prefix (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:312:13)
  at C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:280:7
  at Function.process_params (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:330:12)
  at next (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:271:10)
  at query (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\middleware\query.js:49:5)
  at Layer.handle [as handle_request] (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\layer.js:95:5)
  at trim_prefix (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:312:13)
  at C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:280:7
  at Function.process_params (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:330:12)
  at next (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:271:10)
  at livereload (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\grunt-express\node_modules\connect-livereload\index.js:151:5)
  at Layer.handle [as handle_request] (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\layer.js:95:5)
  at trim_prefix (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:312:13)
  at C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:280:7
  at Function.process_params (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:330:12)
  at next (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:271:10)
  at Function.handle (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:176:3)
  at EventEmitter.handle (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\application.js:173:10)
  at Server.app (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\express.js:38:9)
  at emitTwo (events.js:87:13)
  at Server.emit (events.js:172:7)
  at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:528:12)
  at HTTPParser.parserOnHeadersComplete (_http_common.js:88:23)

Error: ENOENT: no such file or directory, scandir 'C:\Users\Toby\Documents\projects\myproject\email-examples\dist'
  at Error (native)
  at Object.fs.readdirSync (fs.js:808:18)
  at getTemplates (C:\Users\Toby\Documents\projects\myproject\email-examples\server.js:33:28)
  at C:\Users\Toby\Documents\projects\myproject\email-examples\server.js:19:18
  at Layer.handle [as handle_request] (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\layer.js:95:5)
  at next (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\route.js:131:13)
  at Route.dispatch (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\route.js:112:3)
  at Layer.handle [as handle_request] (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\layer.js:95:5)
  at C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:277:22
  at Function.process_params (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:330:12)
  at next (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:271:10)
  at expressInit (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\middleware\init.js:33:5)
  at Layer.handle [as handle_request] (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\layer.js:95:5)
  at trim_prefix (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:312:13)
  at C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:280:7
  at Function.process_params (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:330:12)
  at next (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:271:10)
  at query (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\middleware\query.js:49:5)
  at Layer.handle [as handle_request] (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\layer.js:95:5)
  at trim_prefix (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:312:13)
  at C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:280:7
  at Function.process_params (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:330:12)
  at next (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:271:10)
  at livereload (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\grunt-express\node_modules\connect-livereload\index.js:151:5)
  at Layer.handle [as handle_request] (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\layer.js:95:5)
  at trim_prefix (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:312:13)
  at C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:280:7
  at Function.process_params (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:330:12)
  at next (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:271:10)
  at Function.handle (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\router\index.js:176:3)
  at EventEmitter.handle (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\application.js:173:10)
  at Server.app (C:\Users\Toby\Documents\projects\myproject\email-examples\node_modules\express\lib\express.js:38:9)
  at emitTwo (events.js:87:13)
  at Server.emit (events.js:172:7)
  at HTTPParser.parserOnIncoming [as onIncoming] (_http_server.js:528:12)
  at HTTPParser.parserOnHeadersComplete (_http_common.js:88:23)

It looks like server.js tries to access dist, which has just been removed by the clean task?

Once this has happened the only way I've found to get the serve task working again is by commenting out 'clean' in the default task (in grunt\aliases.yaml)

developering commented 8 years ago

@toby1kenobi Thanks for the tip on commenting out the clean task. I'm also on Windows 10 and am seeing the same issue. Unfortunately, it makes the grunt serve task basically unusable. Removing the clean task seems to be the workaround for now.

taeo commented 7 years ago

@toby1kenobi or @developering - if you're still using this project, and want to help us debug (a year later... eek).

I'm not a WIN user, but I believe it's a permissions issue. A couple things worth trying.

  1. Try editing the clean task in grunt/clean.js to this:

    // Clean your /dist folder
    module.exports = {
    clean: ["dist/*"]
    };
  2. Check your permissions on the project root folder and dist/, making sure they're writable.

eldyvoon commented 7 years ago

@taeo it doesn't solve the problem.

taeo commented 7 years ago

@eldyvoon - I'm confused.

You say here "it doesn't solve the problem", then you submitted PR #89 which does exactly what I recommended in my suggestion 1 above in grunt/clean.js changing ["dist"] > ["dist/*"].

Please clarify + confirm my assumptions about your comments for me and anyone else reading this down the road.

  1. Your PR #89 (my suggestion 1) does solve the issue.
  2. Permissions making dist/ writable does not solve the issue.
eldyvoon commented 7 years ago

@taeo, I made a PR but then later on I found that it doesn't solve the problem, simply ignore my PR. My workaround is to use grunt clean and grunt serve. Changing to ["dist/*"] doesn't help, try to add one new file while keeping grunt serve running.

taeo commented 7 years ago

Ok. I assume you are a WIN user? (I'm on a Mac and it's just fine) To the best of my knowledge EPERM is a windows specific, permissions related error.

Perhaps you could share your OS + Software versions for myself or others to help hone in on a fix?

sakib0hasan commented 7 years ago

Hey, if anyone is still having the issue: this code works for me.

module.exports = { clean: ["dist/*.html"] };

Hope it helps.