{"id":1101,"date":"2019-08-22T20:06:06","date_gmt":"2019-08-22T20:06:06","guid":{"rendered":"http:\/\/kabiliravi.com\/?page_id=1101"},"modified":"2019-08-22T20:27:57","modified_gmt":"2019-08-22T20:27:57","slug":"install-nodejs-on-mac","status":"publish","type":"page","link":"http:\/\/kabiliravi.com\/index.php\/software\/programming\/my-javascript-tutorial\/install-nodejs-using-nvm\/install-nodejs-on-mac\/","title":{"rendered":"Install Node.js on Mac"},"content":{"rendered":"\n<p>I encourage install <strong>Node.js<\/strong> using <strong>Node Version Manager (nvm)<\/strong> tool, so that you can switch easily between different versions of Node.js, specially when you are working with different projects that are tied to different versions of Node.js.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Install nvm<\/h1>\n\n\n\n<p>On Mac machines, you can use Homebrew to install <strong>nvm<\/strong>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ brew install nvm<\/pre>\n\n\n\n<p>If the installation goes successfully, you will see following comments in installation logs:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">==&gt; Renamed Formulae\n confluent-oss -&gt; confluent-platform                          transmission -&gt; transmission-cli\n ==&gt; Downloading https:\/\/github.com\/creationix\/nvm\/archive\/v0.34.0.tar.gz\n ==&gt; Downloading from https:\/\/codeload.github.com\/nvm-sh\/nvm\/tar.gz\/v0.34.0\n ################################################################## 100.0%\n ==&gt; Caveats\n Please note that upstream has asked us to make explicit managing\n nvm via Homebrew is unsupported by them and you should check any\n problems against the standard nvm install method prior to reporting.\n You should create NVM's working directory if it doesn't exist:\n mkdir ~\/.nvm\n Add the following to ~\/.zshrc or your desired shell\n configuration file:\n export NVM_DIR=\"$HOME\/.nvm\"\n   [ -s \"\/usr\/local\/opt\/nvm\/nvm.sh\" ] &amp;&amp; . \"\/usr\/local\/opt\/nvm\/nvm.sh\"  # This loads nvm\n   [ -s \"\/usr\/local\/opt\/nvm\/etc\/bash_completion\" ] &amp;&amp; . \"\/usr\/local\/opt\/nvm\/etc\/bash_completion\"  # This loads nvm bash_completion<\/pre>\n\n\n\n<p>In &#8220;Please note &#8230;&#8221; phrase please notice that you need to create a folder called <strong>.nvm<\/strong> in your home director:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$  mkdir ~\/.nvm<\/pre>\n\n\n\n<p>And based on your shell terminal manager you need to put following lines in their startup profile files:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">export NVM_DIR=\"$HOME\/.nvm\"\n[ -s \"\/usr\/local\/opt\/nvm\/nvm.sh\" ] &amp;&amp; . \"\/usr\/local\/opt\/nvm\/nvm.sh\"  # This loads nvm\n[ -s \"\/usr\/local\/opt\/nvm\/etc\/bash_completion\" ] &amp;&amp; . \"\/usr\/local\/opt\/nvm\/etc\/bash_completion\"  # This loads nvm bash_completion<\/pre>\n\n\n\n<p>For <strong>Zsh<\/strong> you will put above lines in <strong>~\/.zshrc<\/strong> file and for <strong>bash<\/strong> in <strong>~\/.bash_profile<\/strong><\/p>\n\n\n\n<h1 class=\"wp-block-heading\">Install Node.js<\/h1>\n\n\n\n<p>Now for install <strong>node.js version 10.16.3<\/strong> for example, you can use nvm command like this:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"> $ nvm install 10.16.3<\/pre>\n\n\n\n<p>You should be able to see a log like this, you it is successfully installed:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Downloading and installing node v10.16.3\u2026\nDownloading https:\/\/nodejs.org\/dist\/v10.16.3\/node-v10.16.3-darwin-x64.tar.xz\u2026\n################################################################## 100.0%\nComputing checksum with shasum -a 256\nChecksums matched!\nNow using node v10.16.3 (npm v6.9.0)\nCreating default alias: default -> 10.16.3 (-> v10.16.3)<\/pre>\n\n\n\n<p>As you see in the last line the default alias will be assigned to your first node.js installation<\/p>\n\n\n\n<p>Using node &#8211;version, you can check your installed node version:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">$ node --version\nv10.16.3<\/pre>\n\n\n\n<p>As the part of node.js installation the <strong>Node Package Manager (npm) <\/strong>command tool also will be installed. You can check npm command line tool version using &#8211;version switch as well:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">npm --version\n6.9.0<\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I encourage install Node.js using Node Version Manager (nvm) tool, so that you can switch easily between different versions of Node.js, specially when you are working with different projects that are tied to different versions of Node.js. Install nvm On Mac machines, you can use Homebrew to install nvm: $ brew install nvm If the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":1097,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"ngg_post_thumbnail":0,"footnotes":""},"class_list":["post-1101","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages\/1101","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/comments?post=1101"}],"version-history":[{"count":7,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages\/1101\/revisions"}],"predecessor-version":[{"id":1360,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages\/1101\/revisions\/1360"}],"up":[{"embeddable":true,"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/pages\/1097"}],"wp:attachment":[{"href":"http:\/\/kabiliravi.com\/index.php\/wp-json\/wp\/v2\/media?parent=1101"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}