{"id":9826,"date":"2022-02-22T02:56:19","date_gmt":"2022-02-22T02:56:19","guid":{"rendered":"https:\/\/green.cloud\/docs\/docly-documentation\/content\/how-to-install-node-js-and-npm-on-debian-11\/"},"modified":"2026-01-19T00:45:44","modified_gmt":"2026-01-19T00:45:44","slug":"how-to-install-node-js-and-npm-on-debian-11","status":"publish","type":"docs","link":"https:\/\/green.cloud\/docs\/how-to-install-node-js-and-npm-on-debian-11\/","title":{"rendered":"How to Install Node.js and NPM on Debian 11"},"content":{"rendered":"<p>Node.js is an open-source and cross-platform JavaScript runtime environment built on Chrome\u2019s V8 JavaScript engine. It is designed for non-blocking, event-driven servers and is primarily used for traditional websites and back-end API services.<\/p>\n<p>In this tutorial, we will show you at least three different ways to install Node.js and npm on a Debian 11 server. We believe in showing multiple methods of installing Node.js will benefit any user, since we all want to<\/p>\n<p><iframe title=\"How to install Node.JS and NPM on Debian 11 | VPS Tutorial\" width=\"1170\" height=\"658\" src=\"https:\/\/www.youtube.com\/embed\/poeJf0vTaTE?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" allowfullscreen><\/iframe><\/p>\n<p>Before starting, you have to make sure that all Debian OS packages installed on the server are up to date. You can do this by running the following commands:<\/p>\n<pre>apt update\r\napt upgrade<\/pre>\n<h1>Method 1: Install Node.js and npm from Debian Repository<\/h1>\n<p>The simple and easiest way to install Node.js and npm is to install them from the Debian default repository. However, it does not contain the latest Node.js version. At the time of writing this tutorial, Node.js version 12.22.5 is included by default on Debian 11 repositories<\/p>\n<p>Install the Node.js and npm with the following command:<\/p>\n<pre>apt install nodejs npm<\/pre>\n<p>Once both packages are installed, verify the Node.js version using the following command:<\/p>\n<pre>node -v<\/pre>\n<p>You should get the following output:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/02\/Screenshot_11-2.png\" alt=\"\" \/><\/p>\n<p>You can also check the npm version using the following command:<\/p>\n<pre>npm -v<\/pre>\n<p>You should get the following output:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/02\/Screenshot_12.png\" alt=\"\" \/><\/p>\n<h1>Method 2: Install Node.js and npm from NodeSource<\/h1>\n<p>If you want to install a different version of Node.js than the one provided in the Debian repositories, you can use this method. NodeSource maintains an APT repository and contains multiple Node.js versions.<\/p>\n<p>At the time of writing this tutorial, the NodeSource repository provides\u00a0<strong>v17<\/strong>,\u00a0<strong>v16<\/strong>,\u00a0<strong>v14<\/strong>, and\u00a0<strong>v12<\/strong>\u00a0versions.<\/p>\n<p>We will install the LTS v16 version.<\/p>\n<p>Install the curl with the following command:<\/p>\n<pre>apt install curl<\/pre>\n<p>Download and run the Node.js installation script by running the following command:<\/p>\n<pre>curl -sL https:\/\/deb.nodesource.com\/setup_16.x | bash -<\/pre>\n<p>This will add the GPG key and Node.js repository to the APT<\/p>\n<p><strong>Note:<\/strong>\u00a0If you want another version of Node.js\u00a0 (for example\u00a0<strong>14x,<\/strong>) you just need to change the\u00a0<strong>setup_16.x<\/strong>\u00a0with\u00a0<strong>setup_14.x<\/strong>.<\/p>\n<p>Install the Node.js version 16.x by running the following command:<\/p>\n<pre>apt install nodejs<\/pre>\n<p>The Node.js package contains both the\u00a0<strong>node<\/strong>\u00a0and\u00a0<strong>npm<\/strong>\u00a0binaries. Once installed, verify the installed version of Node.js with the following command:<\/p>\n<pre>node -v<\/pre>\n<p>You should get the following output:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/02\/Screenshot_13.png\" alt=\"\" \/><\/p>\n<p>You can also verify the npm version with the following command:<\/p>\n<pre>npm -v<\/pre>\n<p>You should get the following output:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/02\/Screenshot_14.png\" alt=\"\" \/><\/p>\n<h1>Method 3: Install Node.js and npm with NVM<\/h1>\n<p>NVM is also known as \u201cNode Version Manager\u201d is a script that allows you to manage multiple versions of Node.js.<\/p>\n<p>You will need to download and install NVM in your system. You can download and run the script manually with the following command:<\/p>\n<pre>curl -o- https:\/\/raw.githubusercontent.com\/nvm-sh\/nvm\/v0.37.2\/install.sh | bash<\/pre>\n<p>The above script makes all the required environment settings to the login script of the currently logged-in user. To apply the settings log out and log in again to your account or just execute the below command to do the same.<\/p>\n<pre>source ~\/.bashrc<\/pre>\n<p>You should get the following output:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/02\/Screenshot_15.png\" alt=\"\" \/><\/p>\n<p>You can list all Node.js versions that can be installed with NVM using the following command:<\/p>\n<pre>nvm list-remote<\/pre>\n<p>This command will show you a long list of all Node.js versions.<\/p>\n<p>Install the latest stable version of Node.js with the following command:<\/p>\n<pre>nvm install node<\/pre>\n<p>You should get the following output:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/02\/Screenshot_16.png\" alt=\"\" \/><\/p>\n<p>Once the installation is completed, verify the Node.js version with the following command:<\/p>\n<pre>node --version<\/pre>\n<p>You should get the following output:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/02\/Screenshot_17.png\" alt=\"\" \/><\/p>\n<p>You can also verify the npm version with the following command:<\/p>\n<pre>npm -v<\/pre>\n<p>You should get the following output:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/02\/Screenshot_18.png\" alt=\"\" \/><\/p>\n<p>If you want to install the latest LTS version, run the following command:<\/p>\n<pre>nvm install --lts<\/pre>\n<p>You can now list all installed Node.js versions using the following command:<\/p>\n<pre>nvm ls<\/pre>\n<p>You should get the following output:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/02\/Screenshot_19.png\" alt=\"\" \/><\/p>\n<p>If you want to switch to the current Node.js version, run the following command:<\/p>\n<pre>nvm use 17.5.0<\/pre>\n<p>You should get the following output:<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/02\/Screenshot_20.png\" alt=\"\" \/><\/p>\n<p>To find the default Node version set for the current user, type:<\/p>\n<pre>nvm run default --version<\/pre>\n<h1>Conclusion<\/h1>\n<p>This tutorial helped you to install Node.js and NPM on Debian 11. Additionally provided you the basic instructions to use the NVM utility.<\/p>\n<p><a href=\"https:\/\/bit.ly\/3tVkc95\"><br \/>\n<img decoding=\"async\" src=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2021\/12\/Linux-1024x171.png\" srcset=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2021\/12\/Linux-1024x171.png 1024w, https:\/\/green.cloud\/docs\/wp-content\/uploads\/2021\/12\/Linux-300x50.png 300w, https:\/\/green.cloud\/docs\/wp-content\/uploads\/2021\/12\/Linux-768x128.png 768w, https:\/\/green.cloud\/docs\/wp-content\/uploads\/2021\/12\/Linux-750x125.png 750w, https:\/\/green.cloud\/docs\/wp-content\/uploads\/2021\/12\/Linux-1140x191.png 1140w, https:\/\/green.cloud\/docs\/wp-content\/uploads\/2021\/12\/Linux.png 1280w\" alt=\"\" \/> <\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Node.js is an open-source and cross-platform JavaScript runtime environment built on Chrome\u2019s V8 JavaScript engine. It is designed for non-blocking, event-driven servers and is primarily used for traditional websites and back-end API services. In this tutorial, we will show you at least three different ways to install Node.js and npm on a Debian 11 server. [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"parent":17817,"menu_order":311,"comment_status":"open","ping_status":"closed","template":"","doc_tag":[],"class_list":["post-9826","docs","type-docs","status-publish","hentry","no-post-thumbnail"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.0 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Install Node.js and NPM on Debian 11 - GreenCloud Documentation<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/green.cloud\/docs\/how-to-install-node-js-and-npm-on-debian-11\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Install Node.js and NPM on Debian 11 - GreenCloud Documentation\" \/>\n<meta property=\"og:description\" content=\"Node.js is an open-source and cross-platform JavaScript runtime environment built on Chrome\u2019s V8 JavaScript engine. It is designed for non-blocking, event-driven servers and is primarily used for traditional websites and back-end API services. In this tutorial, we will show you at least three different ways to install Node.js and npm on a Debian 11 server. [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/green.cloud\/docs\/how-to-install-node-js-and-npm-on-debian-11\/\" \/>\n<meta property=\"og:site_name\" content=\"GreenCloud Documentation\" \/>\n<meta property=\"article:modified_time\" content=\"2026-01-19T00:45:44+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/02\/Screenshot_11-2.png\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-node-js-and-npm-on-debian-11\\\/\",\"url\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-node-js-and-npm-on-debian-11\\\/\",\"name\":\"How to Install Node.js and NPM on Debian 11 - GreenCloud Documentation\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-node-js-and-npm-on-debian-11\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-node-js-and-npm-on-debian-11\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/green.cloud\\\/docs\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/Screenshot_11-2.png\",\"datePublished\":\"2022-02-22T02:56:19+00:00\",\"dateModified\":\"2026-01-19T00:45:44+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-node-js-and-npm-on-debian-11\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-node-js-and-npm-on-debian-11\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-node-js-and-npm-on-debian-11\\\/#primaryimage\",\"url\":\"https:\\\/\\\/green.cloud\\\/docs\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/Screenshot_11-2.png\",\"contentUrl\":\"https:\\\/\\\/green.cloud\\\/docs\\\/wp-content\\\/uploads\\\/2022\\\/02\\\/Screenshot_11-2.png\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/how-to-install-node-js-and-npm-on-debian-11\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/green.cloud\\\/docs\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"GreenCloud Documents\",\"item\":\"https:\\\/\\\/green.cloud\\\/docs\\\/docs\\\/greencloud-documents\\\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Linux Operating Systems\",\"item\":\"https:\\\/\\\/green.cloud\\\/docs\\\/linux-operating-systems\\\/\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"How to Install Node.js and NPM on Debian 11\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/green.cloud\\\/docs\\\/#website\",\"url\":\"https:\\\/\\\/green.cloud\\\/docs\\\/\",\"name\":\"GreenCloud Documentation\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/green.cloud\\\/docs\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Install Node.js and NPM on Debian 11 - GreenCloud Documentation","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:\/\/green.cloud\/docs\/how-to-install-node-js-and-npm-on-debian-11\/","og_locale":"en_US","og_type":"article","og_title":"How to Install Node.js and NPM on Debian 11 - GreenCloud Documentation","og_description":"Node.js is an open-source and cross-platform JavaScript runtime environment built on Chrome\u2019s V8 JavaScript engine. It is designed for non-blocking, event-driven servers and is primarily used for traditional websites and back-end API services. In this tutorial, we will show you at least three different ways to install Node.js and npm on a Debian 11 server. [&hellip;]","og_url":"https:\/\/green.cloud\/docs\/how-to-install-node-js-and-npm-on-debian-11\/","og_site_name":"GreenCloud Documentation","article_modified_time":"2026-01-19T00:45:44+00:00","og_image":[{"url":"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/02\/Screenshot_11-2.png","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/green.cloud\/docs\/how-to-install-node-js-and-npm-on-debian-11\/","url":"https:\/\/green.cloud\/docs\/how-to-install-node-js-and-npm-on-debian-11\/","name":"How to Install Node.js and NPM on Debian 11 - GreenCloud Documentation","isPartOf":{"@id":"https:\/\/green.cloud\/docs\/#website"},"primaryImageOfPage":{"@id":"https:\/\/green.cloud\/docs\/how-to-install-node-js-and-npm-on-debian-11\/#primaryimage"},"image":{"@id":"https:\/\/green.cloud\/docs\/how-to-install-node-js-and-npm-on-debian-11\/#primaryimage"},"thumbnailUrl":"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/02\/Screenshot_11-2.png","datePublished":"2022-02-22T02:56:19+00:00","dateModified":"2026-01-19T00:45:44+00:00","breadcrumb":{"@id":"https:\/\/green.cloud\/docs\/how-to-install-node-js-and-npm-on-debian-11\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/green.cloud\/docs\/how-to-install-node-js-and-npm-on-debian-11\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/green.cloud\/docs\/how-to-install-node-js-and-npm-on-debian-11\/#primaryimage","url":"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/02\/Screenshot_11-2.png","contentUrl":"https:\/\/green.cloud\/docs\/wp-content\/uploads\/2022\/02\/Screenshot_11-2.png"},{"@type":"BreadcrumbList","@id":"https:\/\/green.cloud\/docs\/how-to-install-node-js-and-npm-on-debian-11\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/green.cloud\/docs\/"},{"@type":"ListItem","position":2,"name":"GreenCloud Documents","item":"https:\/\/green.cloud\/docs\/docs\/greencloud-documents\/"},{"@type":"ListItem","position":3,"name":"Linux Operating Systems","item":"https:\/\/green.cloud\/docs\/linux-operating-systems\/"},{"@type":"ListItem","position":4,"name":"How to Install Node.js and NPM on Debian 11"}]},{"@type":"WebSite","@id":"https:\/\/green.cloud\/docs\/#website","url":"https:\/\/green.cloud\/docs\/","name":"GreenCloud Documentation","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/green.cloud\/docs\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs\/9826","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs"}],"about":[{"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/types\/docs"}],"author":[{"embeddable":true,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/comments?post=9826"}],"version-history":[{"count":2,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs\/9826\/revisions"}],"predecessor-version":[{"id":19503,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs\/9826\/revisions\/19503"}],"up":[{"embeddable":true,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/docs\/17817"}],"wp:attachment":[{"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/media?parent=9826"}],"wp:term":[{"taxonomy":"doc_tag","embeddable":true,"href":"https:\/\/green.cloud\/docs\/wp-json\/wp\/v2\/doc_tag?post=9826"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}