Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript

Christopher Stuart
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Christopher Stuart
Full Stack JavaScript Techdegree Graduate 27,771 Points

Error When Creating Model in Sequelize

When I go to create the model as Andrew does in the video--I'm getting this error and have no idea what the issue might be. Anyone ever seen this problem?

C:\Users\crstu\AppData\Roaming\npm\node_modules\sequelizecli\node_modules\yargs\yargs.js:1079

else throw err ^

TypeError: Cannot read property 'toUpperCase' of undefined at eval (lodash.templateSources[0]:18:33) at Array.forEach (<anonymous>)

Seth Kroger
Seth Kroger
56,413 Points

What's the rest of the stack trace? It's likely you passed in a bad value to sequalize somewhere that didn't cause an error until it was deep inside the sequalize's code.

3 Answers

Seth Kroger
Seth Kroger
56,413 Points

You have an extra space between 'id:' and 'integer' at the end unlike all the others. This would cause any terminal/shell to split them as separate arguments.

Christopher Stuart
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
Christopher Stuart
Full Stack JavaScript Techdegree Graduate 27,771 Points

here it is

C:\Users\chr\Desktop\JS\library-manager-v1>sequelize model:generate --na
me Patrons --attributes first_name:string, last_name:string, address:string, ema
il:string, library_id:string, zip_code:integer, id: integer

Sequelize CLI [Node: 8.8.1, CLI: 3.1.0, ORM: 4.23.1]

WARNING: This version of Sequelize CLI is not fully compatible with Sequelize v4
. https://github.com/sequelize/cli#sequelize-support

C:\Users\chr\AppData\Roaming\npm\node_modules\sequelize-cli\node_modules
\yargs\yargs.js:1079
      else throw err
           ^

TypeError: Cannot read property 'toUpperCase' of undefined
    at eval (lodash.templateSources[0]:18:33)
    at Array.forEach (<anonymous>)
    at eval (lodash.templateSources[0]:14:26)
    at Object.render (C:\Users\chr\AppData\Roaming\npm\node_modules\sequ
elize-cli\lib\helpers\template-helper.js:26:54)
    at Object.generateFileContent (C:\Users\chr\AppData\Roaming\npm\node
_modules\sequelize-cli\lib\helpers\model-helper.js:31:37)
    at Object.generateFile (C:\Users\chr\AppData\Roaming\npm\node_module
s\sequelize-cli\lib\helpers\model-helper.js:41:49)
    at Object.exports.handler (C:\Users\chr\AppData\Roaming\npm\node_mod
ules\sequelize-cli\lib\commands\model_generate.js:32:27)
    at Object.self.runCommand (C:\Users\chr\AppData\Roaming\npm\node_mod
ules\sequelize-cli\node_modules\yargs\lib\command.js:233:22)
    at Object.Yargs.self._parseArgs (C:\Users\chr\AppData\Roaming\npm\no
de_modules\sequelize-cli\node_modules\yargs\yargs.js:990:30)
    at Object.get [as argv] (C:\Users\chr\AppData\Roaming\npm\node_modul
es\sequelize-cli\node_modules\yargs\yargs.js:927:19)
    at Object.<anonymous> (C:\Users\chr\AppData\Roaming\npm\node_modules
\sequelize-cli\lib\sequelize:84:16)
    at Module._compile (module.js:612:30)
    at Object.Module._extensions..js (module.js:623:10)
    at Module.load (module.js:531:32)
    at tryModuleLoad (module.js:494:12)
    at Function.Module._load (module.js:486:3)
    at Function.Module.runMain (module.js:653:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3

C:\Users\chr\Desktop\JS\library-manager-v1>