title: NextJS cannot find a valid build in the '.next' directory
body: <p>I looked at the following question before asking this one but I believe mine is different because I am not using Docker: <a href="https://stackoverflow.com/questions/49676338/nextjs-fails-to-find-valid-build-in-the-next-directory-in-production-node-env">Nextjs fails to find valid build in the &#39;.next&#39; directory in production node_env</a></p>
  
  <p>I also tried <a href="https://github.com/zeit/next.js/issues/2691" rel="noreferrer">this</a> approach of removing the '.next' folder but still get the same issue.</p>
  
  <p>After fixing a host of other issues, I am down to one I cannot seem to resolve.  When I try to deploy to Heroku I keep getting the following error: </p>
  
  <pre><code>node server.js
  
  Could not find a valid build in the '.next' directory! Try building your app with 'next build' before starting the server.
  </code></pre>
  
  <p>Here is my package.json file: </p>
  
  <pre><code>{
    "name": "StarterApp",
    "version": "1.0.0",
    "engines": {
      "node": "10.4.1"
    },
    "description": "",
    "main": "index.js",
    "scripts": {
      "test": "mocha",
      "dev": "node server.js"
    },
    "author": "",
    "license": "ISC",
    "dependencies": {
      "express": "4.16.3",
      "fs-extra": "^5.0.0",
      "ganache-cli": "^6.1.3",
      "mocha": "^5.2.0",
      "next": "^4.2.3",
      "next-routes": "^1.4.2",
      "node-gyp": "^3.7.0",
      "react": "^16.4.1",
      "react-dom": "^16.4.1",
      "rebuild": "^0.1.2",
      "semantic-ui-css": "^2.3.2",
      "semantic-ui-react": "^0.79.1",
      "sha3": "^1.2.2",
      "solc": "^0.4.24",
      "truffle-hdwallet-provider": "0.0.3",
      "web3": "^1.0.0-beta.34"
    }
  }
  </code></pre>
  
  <p>Server.js file:</p>
  
  <pre><code>const { createServer } = require('http');
  const next = require('next');
  
  const app = next({
    dev: process.env.NODE_ENV !== 'production'
  });
  
  const routes = require('./routes');
  const handler = routes.getRequestHandler(app);
  
  app.prepare().then(() =&gt; {
    createServer(handler).listen(5000, (err) =&gt; {
      if (err) throw err;
      console.log('Ready on localhost:5000');
    });
  });
  </code></pre>
  
  <p>The app deploys without issue locally but I get this error when deploying to Heroku.  What am I doing wrong? </p>