过去一周我一直在尝试使用Keystone CMS,我意识到如果您使用在帖子类别部分创建的类别标记了帖子,则会出现以下错误:
TypeError: Object #<Object> has no method 'each'
at Promise.<anonymous> (/Users/clippetmac/Sites/keystone/routes/views/blog.js:31:10)
at Promise.<anonymous> (/Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:177:8)
at Promise.emit (events.js:95:17)
at Promise.emit (/Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:84:38)
at Promise.fulfill (/Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:97:20)
at Promise.resolve (/Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/lib/promise.js:108:23)
at Promise.<anonymous> (/Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:177:8)
at Promise.emit (events.js:95:17)
at Promise.emit (/Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:84:38)
at Promise.fulfill (/Use rs/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mpromise/lib/promise.js:97:20)
at /Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/lib/query.js:1052:26
at model.Document.init (/Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/lib/document.js:250:11)
at completeMany (/Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/lib/query.js:1050:12)
at Object.cb (/Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/lib/query.js:1016:11)
at Object._onImmediate (/Users/clippetmac/Sites/keystone/node_modules/keystone/node_modules/mongoose/node_modules/mquery/lib/utils.js:137:16)
at processImmediate [as _immediateCallback] (timers.js:336:15)
任何想法为什么?
答案 0 :(得分:0)
这里的主要问题是我初始化的异步对象没有“each”方法。事实证明我使用的是几个月前我已经下载的旧异步库。我安装了最新版本的async,它就像一个魅力。