{"id":386,"date":"2024-02-07T15:08:51","date_gmt":"2024-02-07T15:08:51","guid":{"rendered":"https:\/\/kurtgrung.com\/blog\/?p=386"},"modified":"2024-02-07T15:12:08","modified_gmt":"2024-02-07T15:12:08","slug":"nvm","status":"publish","type":"post","link":"https:\/\/kurtgrung.com\/blog\/nvm\/","title":{"rendered":"NVM"},"content":{"rendered":"\n<p>Setting up <a href=\"https:\/\/github.com\/nvm-sh\/nvm\" target=\"_blank\" rel=\"noreferrer noopener\">NVM<\/a> (Node Version Manager) on macOS, <br><br><em>nvm<\/em>\u00a0is a version manager for node.js, designed to be installed per-user, and invoked per-shell.\u00a0<em>nvm<\/em>\u00a0works on any POSIX-compliant shell (sh, dash, ksh, zsh, bash)\u00a0&#8230;<br><\/p>\n\n\n\n<p><strong>Install NVM:<\/strong><\/p>\n\n\n\n<p>Open a terminal window and run the following command to download the NVM installation script from the official GitHub repository:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -o- https:\/\/raw.githubusercontent.com\/nvm-sh\/nvm\/v0.39.1\/install.sh | bash<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>Open your shell configuration file in a text editor. Depending on your shell, it could be <code>~\/.bash_profile<\/code>, <code>~\/.bashrc<\/code>, <code>~\/.zshrc<\/code>, or <code>~\/.profile<\/code>. For example, to edit <code>~\/.zshrc<\/code>, you can use the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano ~\/.zshrc<\/code><\/pre>\n\n\n\n<p><br>Add the following lines to the bottom of the file: <br><br>These lines will initialize NVM whenever you start a new shell session.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>export NVM_DIR=\"$HOME\/.nvm\"\n&#91; -s \"$NVM_DIR\/nvm.sh\" ] &amp;&amp; \\. \"$NVM_DIR\/nvm.sh\"  # This loads nvm\n&#91; -s \"$NVM_DIR\/bash_completion\" ] &amp;&amp; \\. \"$NVM_DIR\/bash_completion\"  # This loads nvm bash_completion\n<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p>These lines will initialize NVM whenever you start a new shell session.<br><br>Save the changes and exit the text editor. In Nano, you can do this by pressing <code>Ctrl + X<\/code>, then <code>Y<\/code>, and then <code>Enter<\/code>.<br><br>After saving the changes, you need to reload your shell configuration for the changes to take effect. You can do this by either restarting your terminal or running<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nvm --version<\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Install Node.js:<\/strong><\/p>\n\n\n\n<p>Once NVM is installed, you can use it to install Node.js. For example, to install the latest LTS version of Node.js, you can run: <br><br>This command installs the latest Long-Term Support (LTS) version of Node.js.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nvm install --lts\n\nnvm install 14 \/\/ if you need node version 14 installed. <\/code><\/pre>\n\n\n\n<p><\/p>\n\n\n\n<p><strong>Set Default Node.js Version (Optional)<\/strong><\/p>\n\n\n\n<p>If you want to set a default Node.js version to use, you can run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/\/ nvm alias default &lt;version>\n\nnvm alias default 14 \/\/ installed node 14 etc <\/code><\/pre>\n\n\n\n<p><br><strong>Verify Node.js Installation<\/strong><\/p>\n\n\n\n<p>You can verify that Node.js is installed correctly by running:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>node -v \/\/ v14 etc. &lt;version> installed. <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Setting up NVM (Node Version Manager) on macOS, nvm\u00a0is a version manager for node.js, designed to be installed per-user, and invoked per-shell.\u00a0nvm\u00a0works on any POSIX-compliant shell (sh, dash, ksh, zsh, bash)\u00a0&#8230; Install NVM: Open a terminal window and run the following command to download the NVM installation script from the official GitHub repository: Open your [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[63,126],"class_list":["post-386","post","type-post","status-publish","format-standard","hentry","category-code","tag-node","tag-nvm"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/kurtgrung.com\/blog\/wp-json\/wp\/v2\/posts\/386","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kurtgrung.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kurtgrung.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kurtgrung.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kurtgrung.com\/blog\/wp-json\/wp\/v2\/comments?post=386"}],"version-history":[{"count":4,"href":"https:\/\/kurtgrung.com\/blog\/wp-json\/wp\/v2\/posts\/386\/revisions"}],"predecessor-version":[{"id":464,"href":"https:\/\/kurtgrung.com\/blog\/wp-json\/wp\/v2\/posts\/386\/revisions\/464"}],"wp:attachment":[{"href":"https:\/\/kurtgrung.com\/blog\/wp-json\/wp\/v2\/media?parent=386"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kurtgrung.com\/blog\/wp-json\/wp\/v2\/categories?post=386"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kurtgrung.com\/blog\/wp-json\/wp\/v2\/tags?post=386"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}