遇到了一個問題: Cannot read property 'length' of undefined
當在首頁點擊進入詳情頁的時候,跳出以下錯誤,不知道是不是跟express的版本有關系,我現在的express已經不包含body-parser,目前這個包需要獨立安裝,麻煩看看,謝謝。
TypeError: /root/nodejsWar/imooc/views/pages/index.jade:6
? ?4| .container
? ?5| .row
?> 6| - each item in movies
? ?7| .col-md-2
? ?8| .thumbnail
? ?9| a(href="/movie/#{item._id}")
Cannot read property 'length' of undefined
? ?at eval (eval at exports.compile (/root/nodejsWar/imooc/node_modules/jade/lib/index.js:218:8), <anonymous>:103:31)
? ?at eval (eval at exports.compile (/root/nodejsWar/imooc/node_modules/jade/lib/index.js:218:8), <anonymous>:224:4)
? ?at eval (eval at exports.compile (/root/nodejsWar/imooc/node_modules/jade/lib/index.js:218:8), <anonymous>:249:22)
? ?at res (/root/nodejsWar/imooc/node_modules/jade/lib/index.js:219:38)
? ?at Object.exports.renderFile (/root/nodejsWar/imooc/node_modules/jade/lib/index.js:380:38)
? ?at Object.exports.renderFile (/root/nodejsWar/imooc/node_modules/jade/lib/index.js:370:21)
? ?at View.exports.__express [as engine] (/root/nodejsWar/imooc/node_modules/jade/lib/index.js:417:11)
? ?at View.render (/root/nodejsWar/imooc/node_modules/express/lib/view.js:128:8)
? ?at tryRender (/root/nodejsWar/imooc/node_modules/express/lib/application.js:640:10)
? ?at Function.render (/root/nodejsWar/imooc/node_modules/express/lib/application.js:592:3)
2017-06-16
你要貼出是從哪取的length 才能找到錯誤啊 看起來是movies的錯誤
2018-08-03
檢查app里面 detail的路由,不要重復定義index的路由
2017-07-01
我也是each item in movies這句報錯,怎么解決噠?