title: Heroku - Error: ENOENT: no such file or directory, stat '/app/dist/index.html'
body: <p>I'm trying to deploy my Angular app on heroku, but getting following error:</p>
  
  <p>Project Structure :</p>
  
  <p>My <code>index.html</code> is within <code>src</code> folder</p>
  
  <p><a href="https://i.stack.imgur.com/NePXc.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NePXc.png" alt="enter image description here"></a></p>
  
  <p><strong>Heroku Logs:</strong></p>
  
  <pre><code>2018-12-06T10:30:46.837610+00:00 heroku[web.1]: Starting process with command `npm start`
  2018-12-06T10:30:50.434505+00:00 app[web.1]: 
  2018-12-06T10:30:50.434529+00:00 app[web.1]: &gt; music-app@0.0.0 start /app
  2018-12-06T10:30:50.434531+00:00 app[web.1]: &gt; node server.js
  2018-12-06T10:30:50.434532+00:00 app[web.1]: 
  2018-12-06T10:30:51.276734+00:00 heroku[web.1]: State changed from starting to up
  2018-12-06T10:30:51.217887+00:00 app[web.1]: Server started running..
  2018-12-06T10:30:51.000000+00:00 app[api]: Build succeeded
  2018-12-06T10:31:05.060270+00:00 heroku[router]: at=info method=GET path="/" host=boulder-app.herokuapp.com request_id=69ed1cd2-fb68-499a-9568-bfb3af482188 fwd="115.112.65.146" dyno=web.1 connect=1ms service=58ms status=404 bytes=380 protocol=https
  2018-12-06T10:31:05.049971+00:00 app[web.1]:  Fetching from../app/dist/index.html
  2018-12-06T10:31:05.060851+00:00 app[web.1]: Error: ENOENT: no such file or directory, stat '/app/dist/index.html'
  </code></pre>
  
  <p><strong>My Package.json:</strong></p>
  
  <pre><code>{
    "name": "music-app",
    "version": "0.0.0",
    "scripts": {
      "ng": "ng",
      "start": "node server.js",
      "build": "ng build",
      "test": "ng test",
      "lint": "ng lint",
      "e2e": "ng e2e",
      "postinstall": "ng build --aot -prod"
    },
    "private": true,
    "dependencies": {
      "@angular/animations": "^6.0.3",
      "@angular/common": "^6.0.3",
      "@angular/compiler": "^6.0.3",
      "@angular/core": "^6.0.3",
      "@angular/forms": "^6.0.3",
      "@angular/http": "^6.0.3",
      "@angular/platform-browser": "^6.0.3",
      "@angular/platform-browser-dynamic": "^6.0.3",
      "@angular/router": "^6.0.3",
      "bootstrap": "^4.1.2",
      "core-js": "^2.5.4",
      "rxjs": "^6.0.0",
      "zone.js": "^0.8.26",
      "@angular/cli": "~6.0.8",
      "@angular/compiler-cli": "^6.0.3",
      "typescript": "~2.7.2",
      "express":"^4.15.3"
    },
    "devDependencies": {
      "@angular-devkit/build-angular": "~0.6.8",
      "@angular/language-service": "^6.0.3",
      "@types/jasmine": "~2.8.6",
      "@types/jasminewd2": "~2.0.3",
      "@types/node": "~8.9.4",
      "codelyzer": "~4.2.1",
      "jasmine-core": "~2.99.1",
      "jasmine-spec-reporter": "~4.2.1",
      "karma": "~1.7.1",
      "karma-chrome-launcher": "~2.2.0",
      "karma-coverage-istanbul-reporter": "~2.0.0",
      "karma-jasmine": "~1.1.1",
      "karma-jasmine-html-reporter": "^0.2.2",
      "protractor": "~5.3.0",
      "ts-node": "~5.0.1",
      "tslint": "~5.9.1"
    },
    "engines":{
      "node":"~8.14.0",
      "npm":"~5.0.0"
    }
  }
  </code></pre>
  
  <p><strong>My server.js:</strong></p>
  
  <pre><code>const express = require('express');
  const app = express();
  const path = require('path');
  
  app.use(express.static(__dirname + '/dist'));
  app.listen(process.env.PORT || 8080);
  
  //PATH LOCATION STARTEGY
  
  app.get('/*', function(req,res){
    const fullPath = path.join(__dirname + '/dist/index.html');
    console.log(" Fetching from.." + fullPath);
      res.sendFile(fullPath);
  })
  
  console.log('Server started running..');
  
  //Changed to run on Heroku
  </code></pre>