codyseibert/tab-tracker

Models index.js undefined 'name' property

KyleTryon opened this issue · 2 comments

Hello Cody!

I have been following the tutorial series, I ended up starting over and running into an issue I didn't run into the first time around. And I have gone as far as to actually copy and paste your code to no avail.

https://github.com/KyleTryon/Shoutify/blob/master/server/src/models/index.js

Here is the output when running the server.

sequelize deprecated String based operators are now deprecated. Please use Symbol based operators for better security, read more at http://docs.sequelizejs.com/manual/tutorial/querying.html#operators node_modules/sequelize/lib/sequelize.js:242:13
/mnt/e/projects/Shoutify/server/src/models/index.js:21
    db[model.name] = model
             ^

TypeError: Cannot read property 'name' of undefined
    at fs.readdirSync.filter.forEach (/mnt/e/projects/Shoutify/server/src/models/index.js:21:14)
    at Array.forEach (<anonymous>)
    at Object.<anonymous> (/mnt/e/projects/Shoutify/server/src/models/index.js:19:4)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Module.require (module.js:604:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/mnt/e/projects/Shoutify/server/src/app.js:5:20)
    at Module._compile (module.js:660:30)
    at Object.Module._extensions..js (module.js:671:10)
    at Module.load (module.js:573:32)
    at tryModuleLoad (module.js:513:12)
    at Function.Module._load (module.js:505:3)
    at Function.Module.runMain (module.js:701:10)
    at startup (bootstrap_node.js:193:16)
    at bootstrap_node.js:617:

I've got the same issue, @KyleTryon how did you solve this?

@alekspetrov It's been a while and I have since started over completely. However, I WAS able to fix this before starting over. The problem was actually my own error. I can't remember completely what it was but there was an area in the video where he wrote some function and then re-wrote it in es6 later on. The issue was my own for sure. Pretty sure it was something where he declared a variable and later turned it into a function and I had missed that.