0

I have a MEAN app located at https://stark-plains-64835.herokuapp.com/. When I go to it, I get an 'Internal Server Error' and an error code of 500. If I manually navigate to any of my API endpoints ('/products' or '/products/:id'), I get the expected JSON response. However, if I try any of my app endpoints ('/', '/shop', or '/shop/:id'), I get the same server error. I have tried everything that I can think of to fix this, but I keep getting the same result.

Here's the heroku logs:

2018-10-01T15:20:01.592271+00:00 heroku[web.1]: Starting process with command npm start 2018-10-01T15:20:04.233481+00:00 app[web.1]: > ecommerce-mean-app@0.0.0 start /app 2018-10-01T15:20:04.233483+00:00 app[web.1]: > node app.js 2018-10-01T15:20:05.748475+00:00 app[web.1]: Server listening on port 14423... 2018-10-01T15:20:05.863818+00:00 app[web.1]: Connected to DB: mongodb://richard:password@ds155577.mlab.com:55577/ecommerce-mean-app 2018-10-01T15:20:06.358783+00:00 heroku[web.1]: State changed from starting to up 2018-10-01T15:20:08.037030+00:00 heroku[router]: at=info method=GET path="/" host=stark-plains-64835.herokuapp.com request_id=433ea581-20b8-483a-ad96-794f055363fa fwd="67.166.19.44" dyno=web.1 connect=1ms service=16ms status=500 bytes=436 protocol=https 2018-10-01T15:20:08.035986+00:00 app[web.1]: Error: Cannot find module 'html' 2018-10-01T15:20:08.036005+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:548:15) 2018-10-01T15:20:08.036007+00:00 app[web.1]: at Function.Module._load (module.js:475:25) 2018-10-01T15:20:08.036009+00:00 app[web.1]: at Module.require (module.js:597:17) 2018-10-01T15:20:08.036011+00:00 app[web.1]: at require (internal/module.js:11:18) 2018-10-01T15:20:08.036013+00:00 app[web.1]: at new View (/app/node_modules/express/lib/view.js:81:14) 2018-10-01T15:20:08.036015+00:00 app[web.1]: at Function.render (/app/node_modules/express/lib/application.js:570:12) 2018-10-01T15:20:08.036017+00:00 app[web.1]: at ServerResponse.render (/app/node_modules/express/lib/response.js:1008:7) 2018-10-01T15:20:08.036019+00:00 app[web.1]: at app.get (/app/app.js:23:7) 2018-10-01T15:20:08.036021+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5) 2018-10-01T15:20:08.036022+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/route.js:137:13) 2018-10-01T15:20:08.036024+00:00 app[web.1]: at Route.dispatch (/app/node_modules/express/lib/router/route.js:112:3) 2018-10-01T15:20:08.036025+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5) 2018-10-01T15:20:08.036026+00:00 app[web.1]: at /app/node_modules/express/lib/router/index.js:281:22 2018-10-01T15:20:08.036028+00:00 app[web.1]: at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12) 2018-10-01T15:20:08.036030+00:00 app[web.1]: at cors (/app/node_modules/cors/lib/index.js:188:7) 2018-10-01T15:20:08.036029+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/index.js:275:10)

Any help will be greatly appreciated. Thank you.

  • Hey Richard! What do your logs say when it errors? You can check them with “heroku logs”. Please update your question with the error message from your logs. – Jon McCartie Oct 1 '18 at 14:58
  • Hi Jon, I've added the heroku logs. Let me know if I need to add any other info or what I can do to get the app deployed correctly. Thanks! – Richard Carrigan Oct 1 '18 at 18:13
  • 1
    I figured it out. The problem was that my server script "app.js" didn't know where to find the static files. After adding app.use(express.static(path.join(__dirname, 'dist')));, the app deploys and runs great! – Richard Carrigan Oct 1 '18 at 19:40
0

It looks like this is the main issue:

01T15:20:08.035986+00:00 app[web.1]: Error: Cannot find module 'html' 
2018-10-01T15:20:08.036005+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:548:15) 
2018-10-01T15:20:08.036007+00:00 app[web.1]: at Function.Module._load (module.js:475:25) 
2018-10-01T15:20:08.036009+00:00 app[web.1]: at Module.require (module.js:597:17) 
2018-10-01T15:20:08.036011+00:00 app[web.1]: at require (internal/module.js:11:18) 2018-10-

So you have a dependency issue. I'd double-check your package.json and make sure that this package is listed properly for production use.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.