title: How can I solve "Cannot read property 'define' of undefined"?
body: <p>In my project I have defined Models using sequelize for data present in Postgresql. I am getting <code>Uncaught Error:  Cannot read property 'define' of undefined TypeError: Cannot read property 'define' of undefined</code>.</p>
  <p>I tried adding <code>var Sequelize = require('sequelize');</code> but that did not work</p>
  <p>How can I resolve this error?</p>
  <p>Models</p>
  <pre><code>module.exports = {
      Customer_data: (sequelize, DataTypes) =&gt; {
          const Customer_data = sequelize.define('Customer_data', {
              termkey: {
                  type: DataTypes.NUMBER,
                  allowNull: false,
                  primaryKey: true
              },
              
          }
          
          return Customer_data;
      }}
  </code></pre>
  <p>Customer_data is being called in routes file</p>
  <p>routes.js file</p>
  <pre><code>const NewFile= require(&quot;../db/newFile&quot;),
        newFile= new NewFile(config.db.release.dataset);
  
  const { sequelize } = newFile;
  const Sequelize = require('sequelize');
  const { Customer_data} = require('../db/Models');
  const customer_data= Customer_data(sequelize, Sequelize);
  
  
  </code></pre>
  <p>newFile.js</p>
  <pre><code>const { db: { release: { color: color1, color2} }, sequelize: conf }
        = require(&quot;config&quot;),
        { Sequelize, Op, NumberTypes } = require(&quot;sequelize&quot;);
  
  module.exports = NewFile;
  class NewFile{
     //code
  }
  
  </code></pre>