{"id":274,"date":"2014-03-11T18:28:38","date_gmt":"2014-03-11T18:28:38","guid":{"rendered":"http:\/\/nikola-breznjak.com\/blog\/?p=274"},"modified":"2015-08-10T07:09:47","modified_gmt":"2015-08-10T07:09:47","slug":"getting-started-with-nodejitsu-on-windows-by-deploying-a-men-framework","status":"publish","type":"post","link":"https:\/\/nikola-breznjak.com\/blog\/javascript\/nodejs\/getting-started-with-nodejitsu-on-windows-by-deploying-a-men-framework\/","title":{"rendered":"Getting started with Nodejitsu on Windows by deploying a MEN framework"},"content":{"rendered":"<p>Disclaimer: I\u2019m in no way affiliated with Nodejitsu or any of the frameworks that I listed below in the post. I\u2019m just documenting my experience with them \u2013 problems (and solutions) I\u2019ve faced while trying these new technologies on a Windows machine.<\/p>\n<p>MEN &#8211; <a href=\"https:\/\/www.mongodb.org\/\">MongoDB<\/a>, <a href=\"http:\/\/expressjs.com\/\">Express<\/a>, <a href=\"http:\/\/nodejs.org\/\">Node.js<\/a>, and if you think MEN is not mean enough, take a look at the post on <a href=\"http:\/\/nikola-breznjak.com\/blog\/nodejs\/deploying-mean-io-to-nodejitsu-from-windows-machine\/\">Deploying MEAN.io to Nodejitsu from Windows machine<\/a>.<\/p>\n<p><a href=\"https:\/\/www.nodejitsu.com\/\">Nodejitsu<\/a>\u00a0is a cloud platform as a service based on Node.js and serves Node.js applications on their platform.\u00a0Signup is free, you don&#8217;t have to enter billing info in order to try 2 months free (yes, databases work too!), just click on the &#8220;Do not select a product now&#8221; button:<br \/>\n<a href=\"http:\/\/nikola-breznjak.com\/blog\/wp-content\/uploads\/2014\/03\/nodejitsuFreeSignup.png\" rel=\"lightbox[274]\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/nikola-breznjak.com\/blog\/wp-content\/uploads\/2014\/03\/nodejitsuFreeSignup.png\" alt=\"nodejitsuFreeSignup\" width=\"471\" height=\"398\" \/><\/a><br \/>\nAfter signing up you get a confirmation mail like this:<\/p>\n<pre>Welcome to Nodejitsu!\r\nYour Nodejitsu account is activated and ready to go!\r\nusername: userName\r\nTo confirm your account, install the latest jitsu:\r\nsudo npm install jitsu -g\r\nand then run:\r\njitsu users confirm userName big-h@5h\r\nThis will allow you to deploy applications with:\r\njitsu deploy<\/pre>\n<p>Setting up databases in the web admin interface is easy as you only have to literally click one button after deciding which database type and provider you want:<br \/>\n<a href=\"http:\/\/nikola-breznjak.com\/blog\/wp-content\/uploads\/2014\/03\/nodejitsuDatabases.png\" rel=\"lightbox[274]\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/nikola-breznjak.com\/blog\/wp-content\/uploads\/2014\/03\/nodejitsuDatabases-1024x627.png\" alt=\"nodejitsuDatabases\" width=\"604\" height=\"369\" \/><\/a><\/p>\n<p>Hackaton starters are gaining momentum \u00a0and there are quite a few of them already like:<\/p>\n<ul>\n<li><a href=\"https:\/\/github.com\/sahat\/hackathon-starter\">Hackaton starter<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/jedireza\/drywall\">Drywall<\/a><\/li>\n<li><a href=\"http:\/\/dozerjs.com\/\">DozerJS<\/a><\/li>\n<li><a href=\"https:\/\/github.com\/dstroot\/skeleton\">Skeleton<\/a><\/li>\n<li><a href=\"http:\/\/www.mean.io\/\">MEAN<\/a>\u00a0&#8211; only one which offers Angular out of the box (a <a href=\"http:\/\/nikola-breznjak.com\/blog\/nodejs\/deploying-mean-io-to-nodejitsu-from-windows-machine\/\">follow up post on this is here<\/a>)<\/li>\n<\/ul>\n<p>I decided to try out <a href=\"https:\/\/github.com\/dstroot\/skeleton\">Skeleton<\/a>, mainly because I liked the &#8220;just right&#8221; Goldilocks reference \ud83d\ude42<\/p>\n<p>So, as the site suggests, you first have to install<span class=\"lang:default decode:true  crayon-inline \">nodemon<\/span>\u00a0, <span class=\"lang:default decode:true  crayon-inline \">gulp <\/span>\u00a0and<span class=\"lang:default decode:true  crayon-inline \">mocha<\/span>\u00a0, then clone the <a href=\"https:\/\/github.com\/dstroot\/skeleton\">github repo<\/a>, <span class=\"lang:default decode:true  crayon-inline\">npm &amp; bower install<\/span>\u00a0everything and you&#8217;re done:<\/p>\n<pre># Install global dependencies\r\nnpm install -g nodemon gulp mocha\r\n\r\n# Clone the repoo (and fetch only the latest commits)\r\ngit clone --depth=1 git@github.com:dstroot\/skeleton.git\r\ncd skeleton\r\n\r\n# Install local dependencies\r\nnpm install\r\nbower install\r\n\r\n# Start everything up with Gulp \r\n# (builds the assets and starts the app with nodemon)\r\ngulp<\/pre>\n<p>Everything works for you? Great! For the rest of unlucky ones, you may got (like me)\u00a0after running\u00a0<span class=\"lang:default decode:true  crayon-inline \">gulp<\/span>\u00a0:<\/p>\n<pre>gulp\r\n\r\nmodule.js:340\r\n    throw err;\r\n          ^\r\nError: Cannot find module 'jshint-stylish'\r\n    at Function.Module._resolveFilename (module.js:338:15)\r\n    at Function.Module._load (module.js:280:25)\r\n    at Module.require (module.js:364:17)\r\n    at require (module.js:380:17)\r\n    at Object.&lt;anonymous&gt; (C:\\Users\\Nikola\\Desktop\\skeleton\\gulpfile.js:22:21)\r\n    at Module._compile (module.js:456:26)\r\n    at Object.Module._extensions..js (module.js:474:10)\r\n    at Module.load (module.js:356:32)\r\n    at Function.Module._load (module.js:312:12)\r\n    at Module.require (module.js:364:17)<\/pre>\n<p>I tried\u00a0<span class=\"lang:default decode:true  crayon-inline \">npm install jshint-stylish<\/span>\u00a0, and ran gulp again:<\/p>\n<pre>C:\\Users\\Nikola\\Desktop\\skeleton&gt;gulp\r\n[gulp] Using gulpfile C:\\Users\\Nikola\\Desktop\\skeleton\\gulpfile.js\r\n[gulp] Starting 'clean'...\r\n[gulp] Finished 'clean' after 11 ms\r\n[gulp] Starting 'styles'...\r\n[gulp] Starting 'scripts'...\r\n[gulp] Starting 'images'...\r\n[gulp] Finished 'images' after 2.75 ms\r\n[gulp] Starting 'lint'...\r\n[gulp] Finished 'lint' after 192 ms\r\n[gulp] Starting 'watch'...\r\n[gulp] Finished 'watch' after 151 ms\r\n[gulp] Starting 'develop'...\r\n[gulp] Finished 'develop' after 1.68 ms\r\n[gulp] Live reload server listening on: 35729\r\n[gulp] gulp-notify: [Gulp notification] Clean task complete\r\n\r\nevents.js:72\r\n        throw er; \/\/ Unhandled 'error' event\r\n              ^\r\nError: Incorrect OS. node-notify requires Mac OS 10.8 or higher\r\n    at C:\\Users\\Nikola\\Desktop\\skeleton\\node_modules\\gulp-notify\\node_modules\\no\r\nde-notifier\\lib\\terminal-notifier.js:46:25\r\n    at Object.module.exports.isMacOSX (C:\\Users\\Nikola\\Desktop\\skeleton\\node_mod\r\nules\\gulp-notify\\node_modules\\node-notifier\\lib\\utils.js:24:12)\r\n    at Notifier.notify (C:\\Users\\Nikola\\Desktop\\skeleton\\node_modules\\gulp-notif\r\ny\\node_modules\\node-notifier\\lib\\terminal-notifier.js:44:11)\r\n    at module.exports (C:\\Users\\Nikola\\Desktop\\skeleton\\node_modules\\gulp-notify\r\n\\lib\\report.js:17:5)\r\n    at Transform._flush (C:\\Users\\Nikola\\Desktop\\skeleton\\node_modules\\gulp-noti\r\nfy\\lib\\notify.js:41:5)\r\n    at Transform.&lt;anonymous&gt; (C:\\Users\\Nikola\\Desktop\\skeleton\\node_modules\\gulp\r\n-notify\\node_modules\\through2\\node_modules\\readable-stream\\lib\\_stream_transform\r\n.js:130:12)\r\n    at Transform.g (events.js:180:16)\r\n    at Transform.EventEmitter.emit (events.js:92:17)\r\n    at finishMaybe (C:\\Users\\Nikola\\Desktop\\skeleton\\node_modules\\gulp-notify\\no\r\nde_modules\\through2\\node_modules\\readable-stream\\lib\\_stream_writable.js:363:12)\r\n\r\n    at endWritable (C:\\Users\\Nikola\\Desktop\\skeleton\\node_modules\\gulp-notify\\no\r\nde_modules\\through2\\node_modules\\readable-stream\\lib\\_stream_writable.js:370:3)<\/pre>\n<p>As the message says (note also\u00a0<a href=\"https:\/\/www.npmjs.org\/package\/node-notifier\">on their website<\/a>), \u00a0<span class=\"lang:default decode:true  crayon-inline \">gulp notify<\/span>\u00a0, which uses <span class=\"lang:default decode:true  crayon-inline \">node-notify<\/span>\u00a0\u00a0is not supported on Windows. The way I solved this was that I removed all of the <span class=\"lang:default decode:true  crayon-inline \">.pipe(notify({ onLast: true, message: &#8216;Scripts task complete&#8217; }))<\/span>\u00a0\u00a0lines from <span class=\"lang:default decode:true  crayon-inline\">gulpfile.js<\/span>, but it still wasn&#8217;t enough! Running lint job made the gulp fail, so I removed that to and woila then it all worked.<\/p>\n<p>A note (though you can look this up on the official github page also) on how to setup Google login by:<\/p>\n<ul>\n<li>Visit\u00a0<a href=\"https:\/\/cloud.google.com\/console\/project\">Google Cloud Console<\/a><\/li>\n<li>Click\u00a0<strong>CREATE PROJECT<\/strong>\u00a0button<\/li>\n<li>Enter\u00a0<em>Project Name<\/em>, then click\u00a0<strong>CREATE<\/strong><\/li>\n<li>Then select\u00a0<em>APIs &amp; auth<\/em>\u00a0from the sidebar and click on\u00a0<em>Credentials<\/em>\u00a0tab<\/li>\n<li>Click\u00a0<strong>CREATE NEW CLIENT ID<\/strong>\u00a0button\n<ul>\n<li><strong>Application Type<\/strong>: Web Application<\/li>\n<li><strong>Authorized Javascript origins<\/strong>: http:\/\/localhost:3000<\/li>\n<li><strong>Authorized redirect URI<\/strong>: http:\/\/localhost:3000\/auth\/google\/callback<\/li>\n<\/ul>\n<\/li>\n<li>Copy and paste\u00a0<em>Client ID<\/em>\u00a0and\u00a0<em>Client secret<\/em>\u00a0keys into\u00a0<code>config\/config.js<\/code><\/li>\n<\/ul>\n<p><img loading=\"lazy\" decoding=\"async\" title=\":exclamation:\" src=\"https:\/\/github.global.ssl.fastly.net\/images\/icons\/emoji\/exclamation.png\" alt=\":exclamation:\" width=\"20\" height=\"20\" align=\"absmiddle\" \/><strong>Note<\/strong>: When you ready to deploy to production don&#8217;t forget to add your new url to\u00a0<strong>Authorized Javascript origins<\/strong>\u00a0and\u00a0<strong>Authorized redirect URI<\/strong>, e.g.\u00a0<code>http:\/\/my-awesome-app.nodejitsu.com<\/code>\u00a0and\u00a0<code>http:\/\/my-awesome-app.nodejitsu.com\/auth\/google\/callback<\/code>\u00a0respectively. The same goes for other providers.<\/p>\n<p>Deploying to Nodejitsu is done by firstly \u00a0loging in and then executing\u00a0<span class=\"lang:default decode:true  crayon-inline\">jitsu deploy<\/span>:<\/p>\n<pre class=\"lang:default decode:true\">C:\\Users\\Nikola\\Desktop\\skeleton&gt;jitsu login\r\ninfo:    Welcome to Nodejitsu hitman666\r\ninfo:    jitsu v0.13.15, node v0.10.26\r\ninfo:    It worked if it ends with Nodejitsu ok\r\ninfo:    Executing command login\r\nprompt: username:  (hitman666)\r\nprompt: password:\r\ninfo:    Authenticated as hitman666\r\ninfo:    Nodejitsu ok\r\n\r\nC:\\Users\\Nikola\\Desktop\\skeleton&gt;jitsu deploy<\/pre>\n<p>Boom, your app is live on Nodejitsu server and it should look like this (ofc YMMV in term of link):<br \/>\n<a href=\"http:\/\/nikola-breznjak.com\/blog\/wp-content\/uploads\/2014\/03\/skeletonWelcomeScreen.jpg\" rel=\"lightbox[274]\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-323\" src=\"http:\/\/nikola-breznjak.com\/blog\/wp-content\/uploads\/2014\/03\/skeletonWelcomeScreen-1024x884.jpg\" alt=\"skeletonWelcomeScreen\" width=\"604\" height=\"521\" srcset=\"https:\/\/nikola-breznjak.com\/blog\/wp-content\/uploads\/2014\/03\/skeletonWelcomeScreen-1024x884.jpg 1024w, https:\/\/nikola-breznjak.com\/blog\/wp-content\/uploads\/2014\/03\/skeletonWelcomeScreen-300x259.jpg 300w, https:\/\/nikola-breznjak.com\/blog\/wp-content\/uploads\/2014\/03\/skeletonWelcomeScreen.jpg 1155w\" sizes=\"auto, (max-width: 604px) 100vw, 604px\" \/><\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Disclaimer: I\u2019m in no way affiliated with Nodejitsu or any of the frameworks that I listed below in the post. I\u2019m just documenting my experience with them \u2013&hellip;<\/p>\n","protected":false},"author":1,"featured_media":277,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,4],"tags":[17,23],"class_list":["post-274","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-codeproject","category-nodejs","tag-nodejitsu","tag-windows-2"],"_links":{"self":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/274","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=274"}],"version-history":[{"count":12,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/274\/revisions"}],"predecessor-version":[{"id":2037,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/posts\/274\/revisions\/2037"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/media\/277"}],"wp:attachment":[{"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/media?parent=274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/categories?post=274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nikola-breznjak.com\/blog\/wp-json\/wp\/v2\/tags?post=274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}