亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定

看到好多人提到這個問題 '_id' of undefined 求大神解決啊

TypeError: C:\Users\Administrator\WebstormProjects\imooc\views\pages\admin.jade:7
? ?5| ? ? ? ? .row?
? ?6| ? ? ? ? ? ? form.form-horizontal(method="post", action="/admin/movie/new")?
?> 7| ? ? ? ? ? ? ? ? input(type="hidden",name="movie[_id]", value="#{movie._id}")?
? ?8| ? ? ? ? ? ? ? ? .form-group?
? ?9| ? ? ? ? ? ? ? ? ? ? label.col-sm-2.control-label(for="inputTitle") 電影名字?
? ?10| ? ? ? ? ? ? ? ? ? ? .col-sm-10?

Cannot read property '_id' of undefined
? ?at eval (eval at <anonymous> (C:\Users\Administrator\WebstormProjects\imooc\node_modules\jade\lib\index.js:218:8), <anonymous>:100:88)
? ?at eval (eval at <anonymous> (C:\Users\Administrator\WebstormProjects\imooc\node_modules\jade\lib\index.js:218:8), <anonymous>:292:22)
? ?at res (C:\Users\Administrator\WebstormProjects\imooc\node_modules\jade\lib\index.js:219:38)
? ?at Object.exports.renderFile (C:\Users\Administrator\WebstormProjects\imooc\node_modules\jade\lib\index.js:380:38)
? ?at Object.exports.renderFile (C:\Users\Administrator\WebstormProjects\imooc\node_modules\jade\lib\index.js:370:21)
? ?at View.exports.__express [as engine] (C:\Users\Administrator\WebstormProjects\imooc\node_modules\jade\lib\index.js:417:11)
? ?at View.render (C:\Users\Administrator\WebstormProjects\imooc\node_modules\express\lib\view.js:126:8)
? ?at tryRender (C:\Users\Administrator\WebstormProjects\imooc\node_modules\express\lib\application.js:639:10)
? ?at EventEmitter.render (C:\Users\Administrator\WebstormProjects\imooc\node_modules\express\lib\application.js:591:3)
? ?at ServerResponse.render (C:\Users\Administrator\WebstormProjects\imooc\node_modules\express\lib\response.js:961:7)
? ?at C:\Users\Administrator\WebstormProjects\imooc\app.js:125:9
? ?at Layer.handle [as handle_request] (C:\Users\Administrator\WebstormProjects\imooc\node_modules\express\lib\router\layer.js:95:5)
? ?at next (C:\Users\Administrator\WebstormProjects\imooc\node_modules\express\lib\router\route.js:131:13)
? ?at Route.dispatch (C:\Users\Administrator\WebstormProjects\imooc\node_modules\express\lib\router\route.js:112:3)
? ?at Layer.handle [as handle_request] (C:\Users\Administrator\WebstormProjects\imooc\node_modules\express\lib\router\layer.js:95:5)
? ?at C:\Users\Administrator\WebstormProjects\imooc\node_modules\express\lib\router\index.js:277:22

正在回答

5 回答

我也是,還是有錯啊

0 回復 有任何疑惑可以回復我~

接上句,還是有錯

0 回復 有任何疑惑可以回復我~

樓主解決了嗎,我加了app.use(bodyParser.urlencoded({extended:true})); ?app.use(bodyParser.json());

0 回復 有任何疑惑可以回復我~

最主要的是?extended:true

1 回復 有任何疑惑可以回復我~

這個是body-parser導致的

先安裝body-parser

然后

代碼如下

在app.js中

var bodyParser=require('body-parser');

app.use(bodyParser.urlencoded({extended:true}));


1 回復 有任何疑惑可以回復我~

舉報

0/150
提交
取消
node+mongodb 建站攻略(一期)
  • 參與學習       91827    人
  • 解答問題       921    個

帶你完整實現一個從前端到后端的項目,初中級前端開發工程師必學課程

進入課程

看到好多人提到這個問題 '_id' of undefined 求大神解決啊

我要回答 關注問題
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號