var cool = require('cool-ascii-faces'); var express = require('express'); var bodyParser = require('body-parser'); var bytes = require('bytes'); var app = express(); app.set('port', (process.env.PORT || 5000)); app.use(express.static(__dirname + '/public')); // views is directory for all template files app.set('views', __dirname + '/views'); app.set('view engine', 'ejs'); app.get('/', function(request, response) { response.render('pages/index'); }); app.get('/cool', function(request, response) { response.send(cool()); }); app.listen(app.get('port'), function() { console.log('Node app is running on port', app.get('port')); }); 

Good day, when I make a request for " body - parser ", then I fill it up with a heroku, it hangs, what could be the reason?

Update

When I delete the line

 var bodyParser = require (' body - parser '); 

then the site is loaded, and when the line is present, the Hero gives out

Please try again in a few moments.

If you are the application owner, check your logs for details. "

That is, when you query 'body - parser', the site freezes

Error that Firefox writes

GET https://blooming-forest-9227.herokuapp.com/index.html [HTTP / 1.1 503 Service Unavailable 4805ms]

Update 2

From Application Log .

 2015-12-18T10:52:22.221940+00:00 app[web.1]: at Object.<anonymous> (/app/index.js:2:18) 2015-12-18T10:52:22.221941+00:00 app[web.1]: at Module.load (module.js:355:32) 2015-12-18T10:52:22.221942+00:00 app[web.1]: at Function.Module._load (module.js:310:12) 2015-12-18T10:52:22.922664+00:00 heroku[web.1]: Process exited with status 1 2015-12-18T10:52:25.536880+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/index.html" host=blooming-forest-9227.herokuapp.com request_id=de7ab448-2911-4bc5-b0d7-87e182960268 fwd="194.44.185.28" dyno= connect= service= status=503 bytes= 2015-12-18T10:52:22.221940+00:00 app[web.1]: at Object.<anonymous> (/app/index.js:2:18) 2015-12-18T10:59:37.726517+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/index.html" host=blooming-forest-9227.herokuapp.com request_id=73ede656-79dd-4ca7-9113-c470c1a2ff0c fwd="194.44.185.28" dyno= connect= service= status=503 bytes= 2015-12-18T10:59:52.731762+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/index.html" host=blooming-forest-9227.herokuapp.com request_id=d92530f9-5776-429f-925e-e060b3af644a fwd="194.44.185.28" dyno= connect= service= status=503 bytes= 2015-12-18T10:59:55.274179+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/index.html" host=blooming-forest-9227.herokuapp.com request_id=62086d88-1260-472e-9a6c-817374a7e2f1 fwd="194.44.185.28" dyno= connect= service= status=503 bytes= 2015-12-18T10:52:22.221941+00:00 app[web.1]: at Module.load (module.js:355:32) 2015-12-18T10:59:52.731762+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/index.html" host=blooming-forest-9227.herokuapp.com request_id=d92530f9-5776-429f-925e-e060b3af644a fwd="194.44.185.28" dyno= connect= service= status=503 bytes= 2015-12-18T11:01:54.274069+00:00 app[web.1]: at Function.Module._resolveFilename (module.js:336:15) 2015-12-18T11:01:54.274069+00:00 app[web.1]: at Function.Module._load (module.js:278:25) 2015-12-18T11:01:54.274071+00:00 app[web.1]: at require (module.js:384:17) 2015-12-18T11:01:54.274074+00:00 app[web.1]: at Function.Module._load (module.js:310:12) 2015-12-18T11:01:54.274074+00:00 app[web.1]: at Function.Module.runMain (module.js:501:10) 2015-12-18T11:01:51.773298+00:00 heroku[web.1]: State changed from crashed to starting 
  • And where does the bodyParser say? You do not use it! - Dmitriy Simushev
  • In the console, where do you run the application which errors? Is body-parser module properly installed? - Dmitriy Simushev
  • the console is empty, body-parser is installed. - Roman Pawliw
  • everything works on the local server - Roman Pawliw
  • And how do you want to debug the problem if it does not even play? In an amicable way, all the fatal errors that cause the node.js process to crash are output to the console. Understand where these messages are written on your hosting. - Dmitriy Simushev

1 answer 1

 var bodyParser = require (' body - parser '); 

Probably, you need to write the correct name of the module, namely, remove the 4 extra spaces.

  • You are probably wrong. Read the comments to the question: " everything works on the local server " - Dmitriy Simushev
  • In addition, in the original question the name of the module is specified correctly. - Dmitriy Simushev
  • @DmitriySimushev, then the author should correct the question and say so. - Qwertiy