title: Heroku not finding express in server.js
body: <p>Been having difficulty in deploying my react app to Heroku . I get the following error:</p>
  <p><code>ReferenceError: express is not defined</code></p>
  <p>Here the project structure:</p>
  <ul>
  <li>backend folder</li>
  <li>frontend folder</li>
  <li>package.json</li>
  <li>Procfile</li>
  </ul>
  <p>Here is my Procfile</p>
  <p><code>web: node backend/server.js</code></p>
  <p>Here is the package.json in the root</p>
  <pre><code>  &quot;name&quot;: &quot;zippora&quot;,
    &quot;version&quot;: &quot;0.1.0&quot;,
    &quot;private&quot;: true,
    &quot;scripts&quot;: {
      &quot;start&quot;: &quot;node backend/server.js&quot;,
      &quot;heroku-postbuild&quot;: &quot;cd frontend &amp;&amp; npm install &amp;&amp; npm run build&quot;
    },
    &quot;engines&quot;: {
      &quot;node&quot;: &quot;16.4.1&quot;,
      &quot;npm&quot;: &quot;7.18.1&quot;
    },
    &quot;dependencies&quot;: {
      &quot;bcrypt&quot;: &quot;^5.0.0&quot;,
      &quot;body-parser&quot;: &quot;^1.19.0&quot;,
      &quot;colors&quot;: &quot;^1.4.0&quot;,
      &quot;cors&quot;: &quot;^2.8.5&quot;,
      &quot;dotenv&quot;: &quot;^8.2.0&quot;,
      &quot;express&quot;: &quot;^5.0.0-alpha.8&quot;,
      &quot;jsonschema&quot;: &quot;^1.4.0&quot;,
      &quot;jsonwebtoken&quot;: &quot;^8.5.1&quot;,
      &quot;morgan&quot;: &quot;^1.10.0&quot;,
      &quot;pg&quot;: &quot;^8.3.0&quot;
    }
  }
  </code></pre>
  <p>My server.js file within the backend folder</p>
  <pre><code>
  const app = require(&quot;./app.js&quot;);
  const { PORT } = require(&quot;./config&quot;);
  app.use(express.static(&quot;../frontend/build/index.html&quot;))
  app.get(&quot;/&quot;, (res,req) =&gt; {
    res.send({&quot;message&quot;:&quot;Hello?&quot;})
  })
  app.listen(PORT, function () {
    console.log(`Started on http://localhost:${PORT}`);
  });
  </code></pre>
  <p>And the top of my app.js file within the backend</p>
  <pre><code>
  /** Express app for zippora. */
  
  const express = require(&quot;express&quot;);
  const cors = require(&quot;cors&quot;);
  
  const { NotFoundError } = require(&quot;./expressError&quot;);
  
  const { authenticateJWT } = require(&quot;./middleware/auth&quot;);
  const authRoutes = require(&quot;./routes/auth&quot;);
  const usersRoutes = require(&quot;./routes/users&quot;);
  
  const morgan = require(&quot;morgan&quot;);
  
  const app = express();```
  </code></pre>