{"id":19748,"date":"2016-08-01T07:57:09","date_gmt":"2016-08-01T12:57:09","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=19748"},"modified":"2022-06-03T03:42:45","modified_gmt":"2022-06-03T08:42:45","slug":"install-node-js-and-create-your-first-express-application","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/","title":{"rendered":"Install Node.js and create your first Express application"},"content":{"rendered":"
<\/div>

\"Install<\/p>\n

In this tutorial, we will explain how to install Node.js and create your first Express JS application on an Ubuntu 16.04 VPS. Express is an open source, fast and flexible web development framework for node.js and provides a robust set of features to develop web and mobile applications. Express is to Node.js what Ruby on Rails<\/a> is to Ruby. This guide should work on other Linux VPS systems as well but was tested and written for an Ubuntu 16.04 VPS<\/a>.
\n<\/p>\n

1. Install Node.js<\/h2>\n

The following instructions assume that you don’t have Node.js installed on your machine.<\/p>\n

We will install the Node.js version 4 LTS Argon from the nodesource (formerly Chris Lea’s Launchpad PPA) repository.<\/p>\n

The command bellow will add the nodesource signing key to your apt keyring, add the deb.nodesource.com repository to your apt sources and run apt-get update<\/code> to update the package sources.<\/p>\n

[user]$ sudo wget -qO- https:\/\/deb.nodesource.com\/setup_4.x | sudo bash -<\/pre>\n

When the command above completes, install the Node.js package with:<\/p>\n

[user]$ sudo apt-get install -y nodejs<\/pre>\n

To check the Node.js version installed on your machine run:<\/p>\n

[user]$ node --version<\/pre>\n

The output should be similar to the following:<\/p>\n

v4.4.7<\/pre>\n

2. Install Express<\/h2>\n

The easiest way to create a new Express projects is a tool called an Express application generator. The application generator tool (express-generator) will help you to quickly create an Express application skeleton.<\/p>\n

Install the express-generator globally using the following command:<\/p>\n

[user]$ sudo npm install express-generator -g<\/pre>\n

You can check the command options with the –help option:<\/p>\n

[user]$ express -h\r\n\r\n  Usage: express [options] [dir]\r\n\r\n  Options:\r\n\r\n    -h, --help          output usage information\r\n    -V, --version       output the version number\r\n    -e, --ejs           add ejs engine support (defaults to jade)\r\n        --hbs           add handlebars engine support\r\n    -H, --hogan         add hogan.js engine support\r\n    -c, --css   add stylesheet  support (less|stylus|compass|sass) (defaults to plain css)\r\n        --git           add .gitignore\r\n    -f, --force         force on non-empty directory\r\n\r\n<\/pre>\n

You can now create a new express application using the express generator tool:<\/p>\n

[user]$ express myNewApp<\/pre>\n

The command above will create a new barebone express application in the myNewApp directory.<\/p>\n

Switch to myNewApp directory and install all the default dependencies using the npm tool\u00a0with the following commands<\/span>:<\/p>\n

[user]$ cd myNewApp\r\n[user]$ npm install<\/pre>\n

Once all the dependencies are installed start the application with the following command:<\/p>\n

[user]$ DEBUG=myNewApp:* npm start<\/pre>\n

You should now have an express application running at: http:\/\/localhost:3000<\/code> . Open the link in your web browser and you should see something like below:<\/p>\n

Express\r\n\r\nWelcome to Express<\/pre>\n

That\u2019s it. You have successfully created your first Express JS application on your Ubuntu 16.04 machine. For more information about Express, please refer to the official Express documentation.<\/p>\n


\n

Of course you don\u2019t have to Install Node.js and create your first Express application, if you use one of our Blazing-Fast SSD\u00a0 VPS Hosting<\/a> services, in which case you can simply ask our expert Linux admins to install this for you. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n

PS<\/strong>.<\/span><\/span> If you liked this post on how to Install Node.js and create your first Express application, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"

In this tutorial, we will explain how to install Node.js and create your first Express JS application on an Ubuntu … <\/p>\n

Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":25087,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13,1712],"tags":[469,357,239],"yoast_head":"\nInstall Node.js and create your first Express application - RoseHosting<\/title>\n<meta name=\"description\" content=\"Install Node.js and create your first Express application - RoseHosting\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Install Node.js and create your first Express application - RoseHosting\" \/>\n<meta property=\"og:description\" content=\"Install Node.js and create your first Express application - RoseHosting\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2016-08-01T12:57:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-03T08:42:45+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/08\/Install-Node.js-and-create-your-first-Express-application.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"1147\" \/>\n\t<meta property=\"og:image:height\" content=\"600\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"Install Node.js and create your first Express application\",\"datePublished\":\"2016-08-01T12:57:09+00:00\",\"dateModified\":\"2022-06-03T08:42:45+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/\"},\"wordCount\":441,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/08\/Install-Node.js-and-create-your-first-Express-application.jpg\",\"keywords\":[\"Express\",\"node.js\",\"nodejs\"],\"articleSection\":[\"Tutorials\",\"Web Frameworks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/\",\"name\":\"Install Node.js and create your first Express application - RoseHosting\",\"isPartOf\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/08\/Install-Node.js-and-create-your-first-Express-application.jpg\",\"datePublished\":\"2016-08-01T12:57:09+00:00\",\"dateModified\":\"2022-06-03T08:42:45+00:00\",\"description\":\"Install Node.js and create your first Express application - RoseHosting\",\"breadcrumb\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/#primaryimage\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/08\/Install-Node.js-and-create-your-first-Express-application.jpg\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/08\/Install-Node.js-and-create-your-first-Express-application.jpg\",\"width\":1147,\"height\":600,\"caption\":\"Install Node.js and create your first Express application\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.rosehosting.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Install Node.js and create your first Express application\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#website\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"name\":\"RoseHosting\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/RoseHosting\",\"https:\/\/x.com\/rosehosting\",\"https:\/\/www.linkedin.com\/in\/rosehosting\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\/\/www.rosehosting.com\",\"https:\/\/www.facebook.com\/rosehosting.helpdesk\"],\"url\":\"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Install Node.js and create your first Express application - RoseHosting","description":"Install Node.js and create your first Express application - RoseHosting","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/","og_locale":"en_US","og_type":"article","og_title":"Install Node.js and create your first Express application - RoseHosting","og_description":"Install Node.js and create your first Express application - RoseHosting","og_url":"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2016-08-01T12:57:09+00:00","article_modified_time":"2022-06-03T08:42:45+00:00","og_image":[{"width":1147,"height":600,"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/08\/Install-Node.js-and-create-your-first-Express-application.jpg","type":"image\/jpeg"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"Install Node.js and create your first Express application","datePublished":"2016-08-01T12:57:09+00:00","dateModified":"2022-06-03T08:42:45+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/"},"wordCount":441,"commentCount":2,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/08\/Install-Node.js-and-create-your-first-Express-application.jpg","keywords":["Express","node.js","nodejs"],"articleSection":["Tutorials","Web Frameworks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/","url":"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/","name":"Install Node.js and create your first Express application - RoseHosting","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/08\/Install-Node.js-and-create-your-first-Express-application.jpg","datePublished":"2016-08-01T12:57:09+00:00","dateModified":"2022-06-03T08:42:45+00:00","description":"Install Node.js and create your first Express application - RoseHosting","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/08\/Install-Node.js-and-create-your-first-Express-application.jpg","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2016\/08\/Install-Node.js-and-create-your-first-Express-application.jpg","width":1147,"height":600,"caption":"Install Node.js and create your first Express application"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/install-node-js-and-create-your-first-express-application\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Install Node.js and create your first Express application"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"]},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/09271207587f897ab46faaed9b355252?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/19748"}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=19748"}],"version-history":[{"count":1,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/19748\/revisions"}],"predecessor-version":[{"id":34819,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/19748\/revisions\/34819"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/25087"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=19748"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=19748"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=19748"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}