简体   繁体   English

无法读取未定义的属性“0”

[英]Cannot read property '0' of undefined

After signing in using facebook, this happens:使用 facebook 登录后,会发生这种情况:

Server running on port: 5000在端口上运行的服务器:5000

GET / 304 28.608 ms - -

GET /auth/facebook 302 5.910 ms - 0

events.js:160
      throw er; // Unhandled 'error' event
  ^

TypeError: Cannot read property '0' of undefined
    at C:\Users\dhouha\node-js-getting-started\config\passport.js:90:49
    at Query.<anonymous> (C:\Users\dhouha\node-js-getting-started\node_modules\mongoose\lib\model.js:3433:16)
    at C:\Users\dhouha\node-js-getting-started\node_modules\kareem\index.js:273:21
    at C:\Users\dhouha\node-js-getting-started\node_modules\kareem\index.js:127:16
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Your program is trying to access the first element of some array (first element with index 0) but it is undefined.您的程序正在尝试访问某个数组的第一个元素(索引为 0 的第一个元素),但它未定义。

Search your code for something[0] in line 90 of:在代码的第 90 行中搜索something[0]

  • C:\\Users\\dhouha\\node-js-getting-started\\config\\passport.js

and try to figure out why the array used there is undefined.并尝试找出为什么在那里使用的数组未定义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM