我正在尝试编写一个DocPad插件,将MongoDB文档导入DocPad数据库,以便在静态网站中使用。源代码位于https://github.com/nfriedly/docpad-plugin-mongodb,并且基于https://github.com/docpad/docpad-plugin-tumblr
当我运行cake test
时,我得到了这个输出:
cake compile
cake install
npm install (for app)
npm install (for test)
npm install (for docpad tests)
coffee compile
npm test
> docpad-plugin-mongodb@2.0.0 test c:\Users\IBM_ADMIN\docpad-plugin-mongodb
> npm run prepare_test_db && node ./out/mongodb.test.js
> docpad-plugin-mongodb@2.0.0 prepare_test_db c:\Users\IBM_ADMIN\docpad-plugin-mongodb
> mongo test/prepare_database.mongo.js
MongoDB shell version: 2.6.5
connecting to: test
connecting to: docpad_plugin_mongodb_test
mongodb
mongodb > create
notice: If everyone who saw this message donated $1/week, maintaining DocPad would become sustainable: http://docpad.org/donate
error: An error occured:
Error: Didn't place the skeleton as the desired structure already exists
at c:\Users\IBM_ADMIN\docpad-plugin-mongodb\node_modules\docpad\out\lib\docpad.js:4107:17
at Object.cb [as oncomplete] (fs.js:168:19)
error: To report the above error, follow the guide at: http://docpad.org/bug-report
mongodb > create OK
mongodb > load plugin mongodb
mongodb > load plugin mongodb OK
mongodb > generate
mongodb > generate > action
warning: You have multiple files being written to c:\Users\IBM_ADMIN\docpad-plugin-mongodb\test\out\testData\1.json, they are:
- testData/1.json:c7
- testData/1.json:c5
Rename one of them to avoid an over-write
FAILURE: 2/3 tests ran successfully; 0 failed, 1 incomplete, 0 errors
npm ERR! Test failed. See above for more details.
npm ERR! not ok code 0
c:\Users\IBM_ADMIN\docpad-plugin-mongodb\Cakefile:99
throw err;
^
Error: Process exited with error status code
at ChildProcess.<anonymous> (c:\Users\IBM_ADMIN\docpad-plugin-mongodb\Cakefile:88:15)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:756:16)
at Process.ChildProcess._handle.onexit (child_process.js:823:5)
而且,当我将模块包含在我的项目中时,它就会在此之后挂起:
$ docpad run
info: Welcome to DocPad v6.69.1 (local installation: c:\Users\IBM_ADMIN\watson-developer-cloud\node_modules\docpad
notice: If everyone who saw this message donated $1/week, maintaining DocPad would become sustainable: http://docp
info: Contribute: http://docpad.org/docs/contribute
info: Plugins: eco, mongodb
info: Environment: development
info: DocPad listening to http://0.0.0.0:9778/ on directory c:\Users\IBM_ADMIN\watson-developer-cloud\out
(如果我访问localhost:9778,它只是挂起并且从不加载页面)
在第一次传递完成后,它似乎只显示来自插件的日志,因此我开始添加throw
语句以查看它在做什么。它似乎成功地从mongo导入了东西,并且它创建了文档,但是当插件调用document.action 'load', (err) ->
时,该回调永远不会被触发。
任何人都可以提供一些关于我搞砸了什么以及如何让事情顺利进行的指导吗?
答案 0 :(得分:0)
修正了它。 TaskGroup库(显然)曾经有一个不再有效的.once('complete', callback)
事件。将它切换到.done(callback)
(并修复其他一些小错误)让我现在正在工作。
它仍然给了我&#34;错误:没有放置骨架,因为所需的结构已经存在&#34;但现在测试都通过了,所以我称之为胜利。