Jon Gunter
Jon Gunter

Reputation: 2114

Error with docpad-plugin-gulp

I'm trying to use the gulp docpad plugin and I get the following error when I execute docpad run:

Error: spawn UNKNOWN
at exports._errnoException (util.js:837:11)
at ChildProcess.spawn (internal/child_process.js:298:11)
at Object.exports.spawn (child_process.js:339:9)
at Task.<anonymous> (C:\Projects\docpad-project\node_modules\docpad-plugin-gulp\node_modules\safeps\es5\lib\safeps.js:595:43)
at ambi (C:\Projects\docpad-project\node_modules\ambi\es5\lib\ambi.js:101:14)
at Domain.fireMethod (C:\Projects\docpad-project\node_modules\taskgroup\out\lib\taskgroup.js:397:23)
at Domain.run (domain.js:191:14)
at Task.fire (C:\Projects\docpad-project\node_modules\taskgroup\out\lib\taskgroup.js:435:27)
at Immediate._onImmediate (C:\Projects\docpad-project\node_modules\taskgroup\out\lib\taskgroup.js:452:26)
at processImmediate [as _immediateCallback] (timers.js:374:17)'

Everything works after uninstalling the plugin.

Upvotes: 0

Views: 96

Answers (1)

user7363501
user7363501

Reputation: 31

Not sure what caused the error, but running Docpad in an elevated command prompt solved the problem for me. I'm working on Windows 10. (I bet this issue is Windows related.)

To open a cmd with admin privileges, hit menu start and type cmd. Then hit ctrl+shift+enter or hit the right mouse button and select 'run as administrator'. The solution works in a Git Bash terminal with extra privileges, as well.

Edit: Today it broke again :/ (to the point that I question whether it did work yesterday...) The quest for an answer has started again...

Edit 2: The error is caused by docpad-plugin-gulp (or its dependencies) for sure; running the Gulp tasks directly works fine. However, I found a setting in docpad-plugin-gulp called background. Setting this to true will run Gulp in the background. More important is that it removes the experienced errors altogether. This leads me to suspect the issue is caused by rule 64-67 of the plugin (out/gulp.plugin.js) or the functions it calls there:

this.safeps.spawn(command, {
    cwd: rootPath,
        output: true
    }, next); 

I hope people more knowledgeable of this topic can confirm my suspicions and/or fix the plugin. For now, updating your docpad.coffee like below should bypass the errors.

docpadConfig = {
    # Other docpad settings

    plugins:
        gulp:
            background: true

}
module.exports = docpadConfig

Upvotes: 1

Related Questions