爆如下错误,这个是什么问题? node.js:201 throw e; // process.nextTick error, or ‘error’ event on first tick ^ TypeError: Cannot read property ‘length’ of null at Promise.<anonymous> (/data/home/htdocs/nodeclub/controllers/tag.js:125:13) at Promise.<anonymous> (/data/home/htdocs/nodeclub/node_modules/mongoose/lib/promise.js:120:8) at Promise.<anonymous> (events.js:67:17) at Promise.emit (/data/home/htdocs/nodeclub/node_modules/mongoose/lib/promise.js:59:38) at Promise.complete (/data/home/htdocs/nodeclub/node_modules/mongoose/lib/promise.js:70:20) at /data/home/htdocs/nodeclub/node_modules/mongoose/lib/query.js:876:30 at Array.0 (/data/home/htdocs/nodeclub/node_modules/mongoose/lib/utils.js:394:16) at EventEmitter._tickCallback (node.js:192:40)
谢谢~
我也出这个错了!!!!!
好吧,我找到解决办法了:
tag.js 125行:判断改成:
if (tags!==null && tags.length > 0) {
res.render('notify/notify', {error: '这个标签已存在。'});
return;
}
因为首次添加标签的时候,数据库还不存在tags这张表,所以你去查,就会报错。 所以而且判断数组长度的时候,数组要存在。。。
^o^
nodeclub后台 在哪添加标签啊?还没找到,在线等