{"id":2088,"date":"2022-08-30T15:21:57","date_gmt":"2022-08-30T15:21:57","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2013\/12\/25\/node-js-heroku-app-crashes-with-error-r10-boot-timeout-heroku-restart-not-working-collection-of-common-programming-errors\/"},"modified":"2022-08-30T15:21:57","modified_gmt":"2022-08-30T15:21:57","slug":"node-js-heroku-app-crashes-with-error-r10-boot-timeout-heroku-restart-not-working-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2022\/08\/30\/node-js-heroku-app-crashes-with-error-r10-boot-timeout-heroku-restart-not-working-collection-of-common-programming-errors\/","title":{"rendered":"Node.js Heroku app crashes with Error R10 (Boot timeout) `heroku restart` not working-Collection of common programming errors"},"content":{"rendered":"<p>Using the below code from an example I found, my Heroku Node.js app crashes. It is not responding when I navigate to [myapp].herokuapp.com<\/p>\n<pre><code>var http = require('http');\nvar port = process.env.PORT || 8000;\n\nvar counter = 0;\n\nhttp.createServer(function (req, res) {\n\n\/\/ increment the counter for each visitor request\ncounter=counter+1;\n\nvar path = req.url;\nconsole.log(\"requested=\" + path + \" counter=\" + counter);\n\nres.writeHead(200, {'Content-Type': 'text\/html'}); \/\/ prepare response headers\n\nres.end(\" :) \"); \n\n}).listen(port);\n<\/code><\/pre>\n<p>my procfile is<\/p>\n<pre><code>web: node thenameofmyapp.js\n<\/code><\/pre>\n<p>I have done <code>heroku ps:scale web=1<\/code><\/p>\n<p>I had some dependencies but removed them to try to get a simple app to work. My current package.json is<\/p>\n<pre><code>{\n  \"name\": \"thenameofmyapp\",\n  \"version\": \"0.0.3\",\n  \"dependencies\": {\n  },\n  \"engines\": {\n    \"node\": \"0.10.x\",\n    \"npm\": \"1.2.x\"\n  }\n}\n<\/code><\/pre>\n<p>Why can&#8217;t my app bind to the port?<\/p>\n<p>EDIT: It looks like even after multiple updates and running <code>heroku restart<\/code>, my app is still running code that doesn&#8217;t exist anymore. What&#8217;s going on here?<\/p>\n<ol>\n<li>\n<p>I&#8217;m not completely sure what happened, but it looked like Heroku was not restarting when I pushed new code or ran <code>heroku restart<\/code>. I created a new app with the same code and it works.<\/p>\n<p>One difference someone else might want to test is that I removed node_packages from my git repo before pushing to the new app.<\/p>\n<\/li>\n<\/ol>\n<p id=\"rop\"><small>Originally posted 2013-12-25 10:58:02. <\/small><\/p>","protected":false},"excerpt":{"rendered":"<p>Using the below code from an example I found, my Heroku Node.js app crashes. It is not responding when I navigate to [myapp].herokuapp.com var http = require(&#8216;http&#8217;); var port = process.env.PORT || 8000; var counter = 0; http.createServer(function (req, res) { \/\/ increment the counter for each visitor request counter=counter+1; var path = req.url; console.log(&#8220;requested=&#8221; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-2088","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2088","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=2088"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/2088\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=2088"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=2088"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=2088"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}