I start with completely fresh project, following Quick Start guide. When saving, let's say, src/documents/posts/hello.html.eco, while docpad run or docpad watch is running on separate shell, docpad fails to regenerate file.
I get this error on both CentOS 6 and Freebsd 9 machines with identical versions of nodejs (0.8.19) and npm (1.2.10), docpad (6.21.10), docpad-plugin-eco (2.0.1) and docpad-plugin-marked (2.1.0).
Here is what was happening in my shell:
→ docpad run
info: Welcome to DocPad v6.21.10
info: Plugins: eco, marked
info: Environment: development
info: DocPad listening to http://localhost:9778/ on directory /home/sergey/code/docpad_fresh/out
info: Generated all 3 files in 0.173 seconds
info: Watching setup starting...
info: Watching setup
info: The action completed successfully
It's all fine so far, file was correctly generated.
Now I edit src/documents/posts/post.html.eco:
info: Regenerating at 07:55:16
info: Generated 1 files in 0.016 seconds
info: Regenerated at 07:55:16
It worked fine as well, file successfully regenerated.
Now I edit src/documents/posts/post.html.eco again (or any other file, it's same result):
info: Regenerating at 07:55:22
info: Generated 0 files in 0.005 seconds
info: Regenerated at 07:55:22
As you can see it didn't really generate any file this time (and the destination file was not regenerated of course).
Now I edit src/documents/posts/post.html.eco once again:
info: Regenerating at 07:55:33
error: An error occured:
Error: EISDIR, open '/home/sergey/code/docpad_fresh/out'
info: Regenerated at 07:55:33
Oops, even an error this time. And so the same error will appear on next files modifications..
Worth noting that I was using docpad a lot before and all was fine, was very stable. It just stopped working a week ago or so (since then I was trying to find source of problem on my end, reinstalled nodejs with all packages completely, upgrading all to latest versions, using 2 machines with different OSes, trying older versions of node and docpad and so on). I really did my best to eliminate any issues that could cause this on my end, but I gave up. Also I tried using node-inspector and running docpad in debug mode, but I just didn't get any worth result. Probably I'm not yet experienced enough with debugging Node applications. Most of the exceptions I encountered were related to few docpad plugins, but looks like the source for this issue is somewhere else as it occurs even when I started project from scratch.
OK, seems like the issue is related directly to docpad releases. I installed email@example.com and files were regenerated there at least, however with errors. I went ahead and tried every minor version one by one starting from latest 21 down to 11 and here is what I got (in short v6.12.0-v6.16.0 seem to work fine, others not that much):
Version 6.18.0 is the latest one for me which successfully regenerated files on save, however with following errors:
info: Regenerating at 11:30:12
warning: Failed to load the file: post.html.eco~
The error follows:
warning: An error occured:
Error: ENOENT, stat '/home/sergey/code/docpad_fresh/src/layouts/post.html.eco~'
info: Generated 3 files in 0.058 seconds
info: Regenerated at 11:30:12
and as follows on next file edit:
error: An error occured:
Error: EISDIR, unlink '/home/sergey/code/docpad_fresh/out'
info: Regenerating at 11:30:23
info: Generated 2 files in 0.017 seconds
info: Regenerated at 11:30:23
But still the file was generated.
Version 6.17.0 doesn't print any errors but file is not regenerated at all
Version 6.11.0 regenerated files but sometimes with following error:
error: An error occured: path must be a string TypeError: path must be a string
at Object.fs.unlink (fs.js:578:11)
at balUtilPaths.unlink (/home/sergey/code/docpad_fresh/node_modules/docpad/node_modules/bal-util/out/lib/paths.js:114:23)
at Object.balUtilPaths.openFile (/home/sergey/code/docpad_fresh/node_modules/docpad/node_modules/bal-util/out/lib/paths.js:39:9)
at Object.balUtilPaths.unlink (/home/sergey/code/docpad_fresh/node_modules/docpad/node_modules/bal-util/out/lib/paths.js:113:20)
at DocumentModel.FileModel.delete (/home/sergey/code/docpad_fresh/node_modules/docpad/out/lib/models/file.js:458:13)
at _Class.DocPad.watch.changeHandler (/home/sergey/code/docpad_fresh/node_modules/docpad/out/lib/docpad.js:2431:30)
at _Class.EventEmitter.emit (events.js:98:17)
at _Class.bubble (/home/sergey/code/docpad_fresh/node_modules/docpad/node_modules/watchr/out/lib/watchr.js:117:10)
at _Class.watchChild.watch.listener (/home/sergey/code/docpad_fresh/node_modules/docpad/node_modules/watchr/out/lib/watchr.js:272:26)
at _Class.EventEmitter.emit (events.js:98:17)
info: Regenerating at 11:48:41
info: Generated 2 files in 0.02 seconds
info: Regenerated at 11:48:41
Yes, I rechecked on both machines and got to conclusion that Docpad v6.16.0 is the latest release that watches and regenerates files just fine on both FreeBSD and CentOS for me.
Thanks! I had similar behavior in ubuntu, I thought vim was the problem and switched to another editor and now I see it's actually in docpad.
I tried docpad v6.16 and v6.11 no luck on ubuntu with any of those.
Similar/same problem here on OS X. Dropped down to 6.16.0 from 6.21.10 and that fixed it. I actually get one regenerate per docpad run on 6.21.10, but after that first regenerate it stalls out.
With DocPad v6.27.0, try add the following to your docpad configuration file:
watchOptions: preferredMethods: ['watchFile','watch']
Does that fix the issue?
Yes, that works for me (and on 6.28.0, too).
Yesterday I learned about DocPad, found it interesting enough to try it out, so today I installed it and started doing my tests, and after much frustration with errors caused at re-generation time, I came across this page.
@balupton's comment about watchOptions fixed it for me as well (using docpad v6.29.0, node v0.10.2, npm v1.2.15). Could this be added to the documentation?
Can everyone please try reinstalling DocPad, removing the preferredMethods option, and let me know if they still get the issue. Pushed a bunch of updates to watchr (DocPad's watching dependency) to try and combat this issue.
Issue doesn't happen in version 6.30.3 installed from scratch on both Linux and BSD machines. Thanks Benjamin!
preferredMethods just solve my problem too on a fresh empty docpad project that after Regenerating at ... message was stop responding. That was my first time using docpad on this OS.
Regenerating at ...
OS: Ubuntu 12.04 LTS 64-bit
Same issue with me; I had this problem a few months back until I used the perferredMethods; It has something to do with our file system API. I use Debian which Ubuntu spawned from. I think this won't be fixed until Lupton has the opportunity to debug on a server with these Operating Systems. Likely the issue will fix all similar distributions. Lupton, try virtual box (https://www.virtualbox.org/) and install a copy of Debian. It might be handy for future issues that occur as well?