{"id":598,"date":"2015-02-24T05:50:33","date_gmt":"2015-02-24T05:50:33","guid":{"rendered":"http:\/\/www.nikola-breznjak.com\/blog\/?p=598"},"modified":"2015-08-10T07:17:24","modified_gmt":"2015-08-10T07:17:24","slug":"keep-your-node-js-scripts-running-with-forever-and-nodemon","status":"publish","type":"post","link":"https:\/\/nikola-breznjak.com\/blog\/javascript\/nodejs\/keep-your-node-js-scripts-running-with-forever-and-nodemon\/","title":{"rendered":"Keep your Node.js scripts running with Forever and Nodemon"},"content":{"rendered":"<p><strong>edit (18.06.2015):\u00a0<\/strong>Nowdays I&#8217;m using PM2, and here&#8217;s my post that explains <a href=\"http:\/\/www.nikola-breznjak.com\/blog\/nodejs\/using-pm2-to-run-your-node-js-apps-like-a-pro\/\">how to use PM2<\/a>.<\/p>\n<hr \/>\n<p><a style=\"color: #bc360a;\" href=\"http:\/\/nodemon.io\/\">Nodemon<\/a>\u00a0is a utility that will monitor for any changes in your source and automatically restart your server. \u00a0Install with npm:<\/p>\n<pre class=\"lang:default decode:true\">npm install -g nodemon<\/pre>\n<p><a href=\"http:\/\/github.com\/nodejitsu\/forever\">Forever<\/a> is a simple CLI tool for ensuring that a given script runs continuously (i.e. forever). Install with npm:<\/p>\n<pre class=\"lang:default decode:true\">npm install -g forever<\/pre>\n<p><a href=\"http:\/\/stackoverflow.com\/questions\/16369018\/forever-nodemon-running-together\">Forever &amp; Nodemon running together<\/a>:<\/p>\n<pre class=\"lang:default decode:true\">forever start nodemon --exitcrash app.js<\/pre>\n<hr \/>\n<p><strong>edit (24.02.2015):<\/strong><\/p>\n<p>If you get an error like this:<\/p>\n<pre class=\"lang:default decode:true\">error:   Cannot start forever\r\nerror:   script \/home\/nikola\/nodemon does not exist.<\/pre>\n<p>Try to run nodemon with the full path:<\/p>\n<pre class=\"lang:default decode:true\">forever start \/usr\/bin\/nodemon --exitcrash app.js<\/pre>\n<p>You can find out the path to nodemon by executing:<\/p>\n<pre class=\"lang:default decode:true\">which nodemon<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>edit (18.06.2015):\u00a0Nowdays I&#8217;m using PM2, and here&#8217;s my post that explains how to use PM2. Nodemon\u00a0is a utility that will monitor for any changes in your source and&hellip;<\/p>\n","protected":false},"author":1,"featured_media":599,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4,15],"tags":[],"class_list":["post-598","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-nodejs","category-quick-tips"],"_links":{"self":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/598","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/comments?post=598"}],"version-history":[{"count":7,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/598\/revisions"}],"predecessor-version":[{"id":1249,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/598\/revisions\/1249"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/media\/599"}],"wp:attachment":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/media?parent=598"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/categories?post=598"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/tags?post=598"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}