发现一个 cnodejs.org 的小 bug
发布于 10个月前 作者 dragon 485 次浏览

刚才点列表的最后一页,(http://cnodejs.org/?page=173)结果出现如下错误:

TypeError: /home/www/nodeclub/views/index.html:10
    8|     <% if (locals.topics && topics.length > 0) { %>
    9|       <div class="inner no-padding">
 >> 10|         <%- partial('topic/list', {
    11|           topics: topics,
    12|           pages: pages,
    13|           current_pages: current_page,

/home/www/nodeclub/views/topic/list.html:2
    1| <div id="topic_list">
 >> 2|  <%- partial('topic/abstract', {collection:topics, as:'topic'}) %>
    3| </div>
    4| <div class='pagination' current_page='<%= current_page %>'>
    5|  <ul>

/home/www/nodeclub/views/topic/abstract.html:3
    1| <div class='cell'>
    2| 
 >> 3|   <a class="user_avatar pull-left" href="/user/<%= topic.author.name %>">
    4|     <img src="<%= topic.author.avatar_url %>"
    5|       title="<%= topic.author.name %>"
    6|     />

Cannot read property 'name' of null
  at eval (<anonymous>:29:125)
  at Object.eval (<anonymous>:29:1864)
  at Object.<anonymous> (/home/www/nodeclub/node_modules/ejs/lib/ejs.js:249:15)
  at ServerResponse.res._render (/home/www/nodeclub/node_modules/express/lib/view.js:425:21)
  at ServerResponse.res.render (/home/www/nodeclub/node_modules/express/lib/view.js:318:17)
  at render (/home/www/nodeclub/node_modules/express/lib/view.js:187:16)
  at renderPartial (/home/www/nodeclub/node_modules/express/lib/view.js:207:16)
  at Object.options.partial (/home/www/nodeclub/node_modules/express/lib/view.js:412:12)
  at eval (<anonymous>:29:59)
  at Object.eval (<anonymous>:32:1438)
  at Object.<anonymous> (/home/www/nodeclub/node_modules/ejs/lib/ejs.js:249:15)
  at ServerResponse.res._render (/home/www/nodeclub/node_modules/express/lib/view.js:425:21)
  at ServerResponse.res.render (/home/www/nodeclub/node_modules/express/lib/view.js:318:17)
  at render (/home/www/nodeclub/node_modules/express/lib/view.js:187:16)
  at renderPartial (/home/www/nodeclub/node_modules/express/lib/view.js:228:12)
  at Object.options.partial (/home/www/nodeclub/node_modules/express/lib/view.js:412:12)
  at eval (<anonymous>:29:306)
  at Object.eval (<anonymous>:34:220)
  at Object.<anonymous> (/home/www/nodeclub/node_modules/ejs/lib/ejs.js:249:15)
  at ServerResponse.res._render (/home/www/nodeclub/node_modules/express/lib/view.js:425:21)
  at ServerResponse.res.render (/home/www/nodeclub/node_modules/express/lib/view.js:318:17)
  at /home/www/nodeclub/controllers/site.js:29:11
  at [object Object]._all (/home/www/nodeclub/node_modules/eventproxy/lib/eventproxy.js:258:16)
  at [object Object].EventProxy.trigger (/home/www/nodeclub/node_modules/eventproxy/lib/eventproxy.js:144:22)
  at /home/www/nodeclub/node_modules/eventproxy/lib/eventproxy.js:501:21
  at /home/www/nodeclub/proxy/topic.js:101:14
  at [object Object].all (/home/www/nodeclub/node_modules/eventproxy/lib/eventproxy.js:364:20)
  at [object Object].EventProxy.trigger (/home/www/nodeclub/node_modules/eventproxy/lib/eventproxy.js:144:22)
  at /home/www/nodeclub/node_modules/eventproxy/lib/eventproxy.js:397:12
  at /home/www/nodeclub/proxy/topic.js:26:12
  at [object Object]._all (/home/www/nodeclub/node_modules/eventproxy/lib/eventproxy.js:258:16)
  at [object Object].EventProxy.trigger (/home/www/nodeclub/node_modules/eventproxy/lib/eventproxy.js:144:22)
  at Promise.<anonymous> (/home/www/nodeclub/node_modules/eventproxy/lib/eventproxy.js:501:21)
  at Promise.<anonymous> (/home/www/nodeclub/node_modules/mongoose/lib/promise.js:120:8)
  at Promise.EventEmitter.emit (events.js:95:17)
  at Promise.emit (/home/www/nodeclub/node_modules/mongoose/lib/promise.js:59:38)
  at Promise.complete (/home/www/nodeclub/node_modules/mongoose/lib/promise.js:70:20)
  at /home/www/nodeclub/node_modules/mongoose/lib/query.js:847:28
  at model.Document.init (/home/www/nodeclub/node_modules/mongoose/lib/document.js:199:11)
  at model.init (/home/www/nodeclub/node_modules/mongoose/lib/model.js:181:36)
  at cb (/home/www/nodeclub/node_modules/mongoose/lib/query.js:845:14)
  at /home/www/nodeclub/node_modules/mongoose/lib/utils.js:408:16
  at /home/www/nodeclub/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:153:9
  at /home/www/nodeclub/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:193:11
  at /home/www/nodeclub/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:539:35
  at Cursor.close (/home/www/nodeclub/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:782:5)
  at Cursor.nextObject (/home/www/nodeclub/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:539:17)
  at /home/www/nodeclub/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:185:12
  at process._tickCallback (node.js:415:13)\n``` 
2 回复

昨天我也发现了

对的,因为昨天操作数据库不小心搞错了一条数据。

现在修复了。

回到顶部