title: Cannot find module: internal/modules/cjs/loader.js:969
body: <p>I wanted to run my app and I suddenly got this error. Why?</p>
  <p>this is what my order looks like in which i work.</p>
  <pre class="lang-none prettyprint-override"><code>./
  ├─ app.js
  ├─ .env
  ├─ .gitignore
  ├─ node modules/
  │  └─ ...
  ├─ package.json
  ├─ package-lock.json
  ├─ models/
  │  └─ advertiser/
  │     └─ advertiser_info.js
  ├─ customer
  └─ db/
     └─ advertiser_db.js
  </code></pre>
  <p>app.js:</p>
  <pre><code>const express = require(&quot;express&quot;);
  const app = express();
  
  /* ******** Database Connection ********* */
  var db = require(&quot;./db/advertiser_db&quot;);
  
  
  db.sequelize.sync().then(() =&gt; {
      console.log(&quot;Database connection successfull&quot;);
      app.listen(process.env.PORT, () =&gt; {
          console.log(&quot;Express listening on &quot; + process.env.PORT);
  
      })
  });
  </code></pre>
  <p>db/advertiser_db.js:</p>
  <pre><code>require(&quot;dotenv&quot;).config();
  const Sequelize = require(&quot;sequelize&quot;);
  const sequelize = new Sequelize(`${process.env.DB_NAME}`, `${process.env.DB_USERNAME}`, `${process.env.DB_PW}`, {
      host: `${process.env.DB_HOST}`,
      dialect: &quot;postgres&quot;
  });
  
  const db = {};
  
  db.n_advertiser = sequelize.import(__dirname + &quot;/models/advertiser/advertiser_info.js&quot;);
  db.sequelize = sequelize;
  db.Sequelize = Sequelize;
  
  module.exports = db;
  </code></pre>
  <p>models/advertiser/advertiser_info.js:</p>
  <pre><code>module.exports = (sequelize, Sequelize) =&gt; {
      return sequelize.define(&quot;advertiser&quot;, {
          blabla: {
              type: Sequelize.STRING,
              allowNull: false,
          },
          blabla: {
              type: Sequelize.STRING,
              allowNull: false,
          },
          email: {
              type: Sequelize.STRING,
              allowNull: false,
              validate: {
                  isEmail: true
              }
          },
          hashedPw: {
              type: Sequelize.STRING,
              allowNull: false
          },
          blabla: {
              type: Sequelize.STRING,
              allowNull: false,
          },
          blabla: {
              type: Sequelize.STRING,
              allowNull: false
          },
          blabla: {
              type: Sequelize.BOOLEAN,
              allowNull: false,
              defaultValue: true,
  
          }
      })
  }
  </code></pre>
  <p>If i Run the app.js file i see this errors:</p>
  <pre><code>internal/modules/cjs/loader.js:969
    throw err;
    ^
  
  Error: Cannot find module '/Users/yildirim/Desktop/nn_backend/db/models/advertiser/advertiser_info.js'
  Require stack:
  - /Users/yildirim/Desktop/nn_backend/node_modules/sequelize/lib/sequelize.js
  - /Users/yildirim/Desktop/nn_backend/node_modules/sequelize/index.js
  - /Users/yildirim/Desktop/nn_backend/db/advertiser_db.js
  - /Users/yildirim/Desktop/nn_backend/app.js
      at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:15)
      at Function.Module._load (internal/modules/cjs/loader.js:842:27)
      at Module.require (internal/modules/cjs/loader.js:1026:19)
      at require (internal/modules/cjs/helpers.js:72:18)
      at Sequelize.import (/Users/yildirim/Desktop/nn_backend/node_modules/sequelize/lib/sequelize.js:481:62)
      at Object.&lt;anonymous&gt; (/Users/yildirim/Desktop/nn_backend/db/advertiser_db.js:10:40)
      at Module._compile (internal/modules/cjs/loader.js:1138:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
      at Module.load (internal/modules/cjs/loader.js:986:32)
      at Function.Module._load (internal/modules/cjs/loader.js:879:14)
      at Module.require (internal/modules/cjs/loader.js:1026:19)
      at require (internal/modules/cjs/helpers.js:72:18)
      at Object.&lt;anonymous&gt; (/Users/yildirim/Desktop/nn_backend/app.js:5:10)
      at Module._compile (internal/modules/cjs/loader.js:1138:30)
      at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
      at Module.load (internal/modules/cjs/loader.js:986:32)
      at Function.Module._load (internal/modules/cjs/loader.js:879:14)
      at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
      at internal/main/run_main_module.js:17:47 {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
      '/Users/yildirim/Desktop/nn_backend/node_modules/sequelize/lib/sequelize.js',
      '/Users/yildirim/Desktop/nn_backend/node_modules/sequelize/index.js',
      '/Users/yildirim/Desktop/nn_backend/db/advertiser_db.js',
      '/Users/yildirim/Desktop/nn_backend/app.js'
    ]
  }
  </code></pre>
  <p>i saw that it shows me a path that doesn't exist at all. Why? I have never defined that path:
  '/Users/yildirim/Desktop/nn_backend/db/models/advertiser/advertiser_info.js'</p>
  <p>thanks for your helpful answers.</p>