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

TypeError: Class constructor Movie cannot be invoked without 'new'

https://teamtreehouse.com/library/using-sql-orms-with-nodejs/getting-started-with-sequelize/define-a-model

In defining an ORM model for NODEjs sequelize:

const Sequelize = require('sequelize') const sequelize = new Sequelize({ dialect: 'sqlite', storage: "movies.db" });

class Movie extends Sequelize.Model {}

Movie.init({ title: Sequelize.STRING }, { sequelize })

// async IIFE (async () => { try { await sequelize.authenticate(); console.log('Connection to the database successful!'); } catch (error) { console.error('Error connecting to the database: ', error); } })();

TypeError: Class constructor Movie cannot be invoked without 'new'