<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Sudhanshu Chaubey</title>
    <description>The latest articles on Forem by Sudhanshu Chaubey (@explorer1699).</description>
    <link>https://forem.com/explorer1699</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F2045608%2F3965407f-1b31-4143-9186-2c20e6240890.png</url>
      <title>Forem: Sudhanshu Chaubey</title>
      <link>https://forem.com/explorer1699</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/explorer1699"/>
    <language>en</language>
    <item>
      <title>Securing Frontend Apps from Lodash Issues</title>
      <dc:creator>Sudhanshu Chaubey</dc:creator>
      <pubDate>Sat, 11 Oct 2025 09:23:01 +0000</pubDate>
      <link>https://forem.com/explorer1699/securing-frontend-apps-from-lodash-issues-3dip</link>
      <guid>https://forem.com/explorer1699/securing-frontend-apps-from-lodash-issues-3dip</guid>
      <description>&lt;p&gt;When working on frontend applications, it’s easy to overlook vulnerabilities hidden inside popular libraries. One common example is &lt;code&gt;Lodash&lt;/code&gt;, a widely used JavaScript utility library. Because it’s bundled into many frameworks and dependencies, outdated versions of Lodash can expose your app to security risks such as prototype pollution. Keeping an eye on these vulnerabilities and knowing how to patch them is essential for maintaining a secure frontend.&lt;/p&gt;

&lt;p&gt;💡 &lt;em&gt;Note:&lt;/em&gt; Our app runs on the Ionic Framework, powered by Angular.&lt;/p&gt;

&lt;h3&gt;
  
  
  🔍 Which tool is used to detect vulnerabilities?
&lt;/h3&gt;

&lt;p&gt;Our organisation used &lt;code&gt;Purplemet&lt;/code&gt;, a security analysis tool designed to scan dependencies and detect known issues. &lt;code&gt;Purplemet&lt;/code&gt; works by checking your project’s package versions against public vulnerability databases (like NVD and GitHub Security Advisories).&lt;/p&gt;

&lt;h4&gt;
  
  
  The best part is that it gives clear insights into:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;Which dependencies are affected&lt;/li&gt;
&lt;li&gt;The severity of the vulnerability&lt;/li&gt;
&lt;li&gt;Recommended fixes or upgrade paths&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This makes it much easier to track vulnerabilities early and prevent them from reaching production.&lt;/p&gt;

&lt;h3&gt;
  
  
  🛠️ What approach I have use to fixed it?
&lt;/h3&gt;

&lt;p&gt;Our frontend application relied heavily on Lodash for data manipulation. To address the vulnerabilities, my approach was to replace Lodash with a custom lodash like utility service.&lt;/p&gt;

&lt;p&gt;The challenge, however, was how to build such a utility service quickly without making major code changes and consume less time. Then's what I decided is to leverage AI to generate a Lodash-like utility service that could act as a drop-in replacement.&lt;/p&gt;

&lt;p&gt;Of course, there was a catch. The AI-generated utility service wasn’t perfect — it had issues with null handling, data types, and other edge cases. After identifying and fixing these problems, and I was finally able to remove Lodash completely from our application and push the updated code for a security rescan.&lt;/p&gt;

&lt;h4&gt;
  
  
  ❌ Outcomes
&lt;/h4&gt;

&lt;p&gt;The approach I used to fix the vulnerability issues wasn’t fully successful. Even after removing Lodash from our codebase, it was still present in our frontend application.&lt;/p&gt;

&lt;h3&gt;
  
  
  🤔 So, what did I try next?
&lt;/h3&gt;

&lt;h4&gt;
  
  
  🕵️ Back to the Hunt
&lt;/h4&gt;

&lt;p&gt;Since my custom Lodash utility service was working perfectly without any issues, I decided to dig deeper and figure out why Lodash was still showing up, even after I thought I’d completely removed it from our app.&lt;/p&gt;

&lt;p&gt;So, I went back to the good old manual search method. After a bit of exploring, I discovered that Lodash was still present inside Angular’s generated folder, i.e., the &lt;code&gt;www&lt;/code&gt; directory. Some of the compiled JavaScript files still had Lodash references!&lt;/p&gt;

&lt;p&gt;Finding that was a small win — but also the start of a new puzzle.&lt;br&gt;
The real question was: &lt;strong&gt;where was Lodash coming from?&lt;/strong&gt;&lt;br&gt;
The &lt;code&gt;www&lt;/code&gt; folder is generated at build time, so it had to be coming from somewhere upstream — likely one of the &lt;strong&gt;dependencies&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;After some digging, that theory turned out to be correct ✅&lt;/p&gt;

&lt;p&gt;To track down which dependency was responsible, I turned to the &lt;code&gt;package.json&lt;/code&gt; and &lt;code&gt;package-lock.json&lt;/code&gt; files. While &lt;code&gt;package.json&lt;/code&gt; contain the lists of main dependencies, it doesn’t give full visibility into nested ones. So, I opened up the &lt;code&gt;package-lock.json&lt;/code&gt;, which contains detailed information about dependency chains — and there it was: the culprit dependency still relying on Lodash.&lt;/p&gt;

&lt;p&gt;Now that I’d found it, the next question was — &lt;strong&gt;what to do next?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;⚙️ &lt;strong&gt;Two Possible Solutions&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;1️⃣ Find an alternative dependency&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Pros: Faster to implement  
Cons: Might introduce minor new vulnerabilities
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;2️⃣ Build a custom replacement&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Pros: Fully secure — custom-built with no known vulnerabilities  
Cons: Time-consuming and requires extra effort
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, I decided to go with the &lt;strong&gt;first option&lt;/strong&gt; — replacing the affected dependency with a secure alternative. After updating it, I ran a few unit tests to ensure everything worked smoothly with the new setup&lt;/p&gt;

&lt;h4&gt;
  
  
  ✅ Outcomes
&lt;/h4&gt;

&lt;p&gt;On my second attempt, the solution was successful!&lt;br&gt;
All Lodash-related vulnerabilities were completely removed, along with other dependency issues. Even better — the application’s performance improved noticeably after the cleanup. 🚀&lt;/p&gt;

&lt;h3&gt;
  
  
  🧩 Conclusion
&lt;/h3&gt;

&lt;p&gt;Fixing vulnerabilities isn’t always a straight path — and this experience proved that for me. What started as a simple Lodash cleanup turned into a deep dive through dependencies, build files, and even some AI-assisted coding experiments.&lt;/p&gt;

&lt;p&gt;While my first attempt didn’t quite hit the mark — Lodash was still hiding inside the build. But on the second try, after tracking down the root dependency and replacing it properly, everything finally came together. 🎉&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The biggest lesson?&lt;/strong&gt; Every failed attempt brings you closer to truly understanding your system — and helps you build more secure, reliable, and maintainable applications in the long run. 💪&lt;/p&gt;

</description>
      <category>lodash</category>
      <category>security</category>
      <category>vulnerabilities</category>
      <category>typescript</category>
    </item>
    <item>
      <title>Setup NVM in your organization/admin system's like a pro</title>
      <dc:creator>Sudhanshu Chaubey</dc:creator>
      <pubDate>Sat, 07 Dec 2024 11:17:03 +0000</pubDate>
      <link>https://forem.com/explorer1699/setup-nvm-in-your-organizationadmin-systems-like-a-pro-1f8</link>
      <guid>https://forem.com/explorer1699/setup-nvm-in-your-organizationadmin-systems-like-a-pro-1f8</guid>
      <description>&lt;p&gt;NVM is an incredibly useful tool for developers, and we owe a big thanks to &lt;a href="https://github.com/coreybutler" rel="noopener noreferrer"&gt;Corey Butler&lt;/a&gt; for creating a version of NVM specifically for Windows users, as the original NVM was designed for Linux/Unix systems. This tool allows developers to manage multiple Node.js versions effortlessly. In professional environments, whether you're working in an organization or as a freelancer, it's common to handle multiple projects—each potentially requiring a specific Node.js version. This is where NVM becomes invaluable, simplifying the process of switching between Node.js versions as needed.&lt;/p&gt;

&lt;p&gt;After installing NVM on my organization's Windows system, I noticed some key points worth sharing.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This post focuses on Windows users, but you can explore similar setups for Mac or Linux/Unix systems.&lt;br&gt;
From what I’ve observed, these issues are unlikely to occur on Mac or Linux/Unix systems.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;After completing the installation, I started using NVM commands like &lt;code&gt;nvm install&lt;/code&gt;, &lt;code&gt;nvm ls&lt;/code&gt;, and others to manage Node.js versions.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nvm ls
nvm install &amp;lt;node-version&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;However, the headache began with the &lt;code&gt;nvm use&lt;/code&gt; command, as it requires &lt;strong&gt;&lt;em&gt;Admin Access&lt;/em&gt;&lt;/strong&gt; to create a Node.js folder on the organization's system.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;nvm use &amp;lt;node-version&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;At that point, the &lt;code&gt;nvm use&lt;/code&gt; command would throw errors like&lt;br&gt;
&lt;code&gt;exit status 1: Access denied&lt;/code&gt; or &lt;code&gt;exit status 5: Access denied.&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;After extensive research, I discovered how the &lt;code&gt;nvm use&lt;/code&gt; command works behind the scenes. In a nutshell, it internally calls the &lt;code&gt;mklink&lt;/code&gt; command, which is used to create symbolic links between directories. On both admin and non-admin systems, the &lt;code&gt;mklink&lt;/code&gt; command is executed, and the full command looks something like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mklink /D nodejs &amp;lt;node-version-folder path&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The command &lt;code&gt;mklink&lt;/code&gt; uses the &lt;code&gt;/D&lt;/code&gt; option to create symbolic directories, which requires full admin privileges. This is where the issue arises—on non-admin systems, &lt;code&gt;nvm use&lt;/code&gt; works fine, but on admin-protected systems with additional security layers, it fails.&lt;/p&gt;

&lt;p&gt;In short, this is a drawback of NVM on admin-protected systems: every time you run &lt;code&gt;nvm use&lt;/code&gt;, it prompts for admin privileges.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Solution:&lt;/strong&gt;&lt;br&gt;
After some research, I found a way to tackle this issue. Instead of using the &lt;code&gt;/D&lt;/code&gt; option with &lt;code&gt;mklink&lt;/code&gt;, which requires admin rights, you can use the &lt;code&gt;/J&lt;/code&gt; option. This creates a symbolic junction between directories and does not need admin privileges. However, it comes with some limitations below are attached images for limitations.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj20s9802ciaukq73veg8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fj20s9802ciaukq73veg8.png" alt="Mklink /D and /J difference between" width="368" height="747"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/9042542/what-is-the-difference-between-ntfs-junction-points-and-symbolic-links" rel="noopener noreferrer"&gt;Image from stackoverflow&lt;/a&gt;&lt;/p&gt;
&lt;h2&gt;
  
  
  Let start setup NVM in our Organization/Admin system's
&lt;/h2&gt;
&lt;h3&gt;
  
  
  Step 1:
&lt;/h3&gt;

&lt;p&gt;create folder of &lt;code&gt;nvm4w&lt;/code&gt;  or &lt;code&gt;any name you like&lt;/code&gt; in any drive which you have right to read-write or full access. And there are two options&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Option 1:
Let’s say if you have only one drive i.e. &lt;code&gt;C:&lt;/code&gt; or any character drive. And it that &lt;code&gt;C:/Users/&amp;lt;your_name&amp;gt;&lt;/code&gt; create folder of &lt;code&gt;nvm4w&lt;/code&gt; or &lt;code&gt;any name you like&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Option 2:
If you have two or more drive let say &lt;code&gt;C:&lt;/code&gt; and &lt;code&gt;D:&lt;/code&gt; drive or any character-based drive. Then it better for you to create folder on &lt;code&gt;D:&lt;/code&gt; drive i.e. &lt;code&gt;D:/nvm4w&lt;/code&gt; or &lt;code&gt;any name you like&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3&gt;
  
  
  Step 2:
&lt;/h3&gt;

&lt;p&gt;After creating a folder with full control access then download the latest nvm-noinstall.zip file from this &lt;a href="https://github.com/coreybutler/nvm-windows/releases" rel="noopener noreferrer"&gt;link&lt;/a&gt;&lt;br&gt;
After downloading done extract zip file and name the folder “nvm” and paste that folder or dir into the folder which you have create from Step 1&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpmyc50zxlvtn36ayhxcy.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fpmyc50zxlvtn36ayhxcy.png" alt="NVM Folder setup" width="800" height="228"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 3:
&lt;/h3&gt;

&lt;p&gt;One step 2 done then configure environment path for you nvm. Add below path and variable both in user and system variable&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;NVM_HOME: Drive_name:\&amp;lt;folder_name&amp;gt;\nvm  (i.e. D:\SOFTWARE\nvm4w\nvm)
NVM_SYMLINK: Drive_name:\&amp;lt;folder_name&amp;gt;\nodejs (i.e. D:\SOFTWARE\nvm4w\nodejs)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Click on new button to add above variables name and it value for both user and system variables&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvxj7ha3ojosaz9xycb7q.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fvxj7ha3ojosaz9xycb7q.png" alt="Path Configuration" width="722" height="779"&gt;&lt;/a&gt;&lt;br&gt;
And register the above two name into the path both in user and system variables section and save it:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flmyuqc9de04ci3v2rb19.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Flmyuqc9de04ci3v2rb19.png" alt="Path register" width="541" height="131"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;NB: Reset the system which is optional in most case.&lt;/em&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 4:
&lt;/h3&gt;

&lt;p&gt;Once it done open command prompt and run &lt;code&gt;nvm -v&lt;/code&gt; to check whether it is working or not. Now need a final touch in order to make nvm install or ls command work in your system. Create a settings.txt file where your nvm folder reside in &lt;code&gt;nvm4w&lt;/code&gt; or any &lt;code&gt;name you have mentioned&lt;/code&gt; which you have created from Step 1 and add below contents.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;root: Drive_name:\&amp;lt;folder_name&amp;gt;\ nvm4w\nvm  (i.e. D:\SOFTWARE\nvm4w\nvm)
path: Drive_name:\&amp;lt;folder_name&amp;gt;\ nvm4w\nodejs  (i.e. D:\SOFTWARE\nvm4w\nodejs)
arch: 64
proxy: none
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Congratulation you have done with your NVM setup fully&lt;/strong&gt;🎉&lt;/p&gt;

&lt;p&gt;Now, you might wonder: "We've set up and configured NVM, but how do we actually use it? The default &lt;code&gt;nvm use&lt;/code&gt; command still won’t work without admin privileges. Was all this setup pointless?"&lt;/p&gt;

&lt;p&gt;Here’s where the magic happens! I created an alternative &lt;code&gt;mklink&lt;/code&gt; command using the &lt;code&gt;/J&lt;/code&gt; option to override the default &lt;code&gt;nvm use&lt;/code&gt; command.&lt;/p&gt;

&lt;p&gt;There are two ways to use this new approach:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Manual Process: Run the &lt;code&gt;mklink&lt;/code&gt; command manually each time you want to switch Node.js versions from command prompt.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;mklink /J nodejs &amp;lt;your_folder_path&amp;gt;\&amp;lt;node-version&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;e.g. mklink /J nodejs D:\SOFTWARE\nvm4w\nvm\v18.20.4&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Automated Process: Create a &lt;code&gt;nvm-use.bat&lt;/code&gt; script and add below code to automate the task, making it easier to execute from the command line.
This ensures you can work with NVM on admin-protected systems without hitting privilege issues.
_NB: Put this nvm-use.bat file into nvm4w folder which you have from Step 1.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight batchfile"&gt;&lt;code&gt;@echo &lt;span class="na"&gt;off&lt;/span&gt;
&lt;span class="nb"&gt;setlocal&lt;/span&gt;

&lt;span class="c"&gt;:: Set NVM and Nodejs path from environment variables&lt;/span&gt;
&lt;span class="kd"&gt;set&lt;/span&gt; &lt;span class="kd"&gt;myNVMPath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;%NVM_HOME%&lt;/span&gt;
&lt;span class="kd"&gt;set&lt;/span&gt; &lt;span class="kd"&gt;myNodeJSPath&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;%NVM_SYMLINK%&lt;/span&gt;

&lt;span class="c"&gt;:: Get list of installed nodejs version in nvm directory&lt;/span&gt;
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="kd"&gt;List&lt;/span&gt; &lt;span class="kd"&gt;of&lt;/span&gt; &lt;span class="kd"&gt;installed&lt;/span&gt; &lt;span class="kd"&gt;nodejs&lt;/span&gt; &lt;span class="kd"&gt;version&lt;/span&gt;:
&lt;span class="kd"&gt;nvm&lt;/span&gt; &lt;span class="kd"&gt;ls&lt;/span&gt;

&lt;span class="c"&gt;:: Prompt the user for the new nodejs directory path&lt;/span&gt;
&lt;span class="kd"&gt;set&lt;/span&gt; &lt;span class="na"&gt;/p &lt;/span&gt;&lt;span class="kd"&gt;newVersion&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"Enter the full version (e.g. 20.15.0) for nodejs: "&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;%newVersion%&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="se"&gt;^C&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;
    &lt;span class="k"&gt;exit&lt;/span&gt; &lt;span class="na"&gt;/b &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;
&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;:: Check if the newVersion is not empty&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;%newVersion%&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="o"&gt;==&lt;/span&gt;&lt;span class="s2"&gt;""&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="kd"&gt;You&lt;/span&gt; &lt;span class="kd"&gt;must&lt;/span&gt; &lt;span class="kd"&gt;enter&lt;/span&gt; &lt;span class="kd"&gt;a&lt;/span&gt; &lt;span class="kd"&gt;version&lt;/span&gt;.
    &lt;span class="k"&gt;exit&lt;/span&gt; &lt;span class="na"&gt;/b &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;
&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;exist&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;%myNVMPath%&lt;/span&gt;&lt;span class="s2"&gt;\v&lt;/span&gt;&lt;span class="nv"&gt;%newVersion%&lt;/span&gt;&lt;span class="s2"&gt;\"&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;
    :: &lt;span class="kd"&gt;Remove&lt;/span&gt; &lt;span class="kd"&gt;the&lt;/span&gt; &lt;span class="kd"&gt;existing&lt;/span&gt; &lt;span class="kd"&gt;nodejs&lt;/span&gt; &lt;span class="kd"&gt;directory&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="kd"&gt;Removing&lt;/span&gt; &lt;span class="kd"&gt;existing&lt;/span&gt; &lt;span class="kd"&gt;nodejs&lt;/span&gt; &lt;span class="kd"&gt;directory&lt;/span&gt;...
    &lt;span class="nb"&gt;rd&lt;/span&gt; &lt;span class="na"&gt;/s /q &lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;%myNodeJSPath%&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

    :: &lt;span class="kd"&gt;Create&lt;/span&gt; &lt;span class="kd"&gt;the&lt;/span&gt; &lt;span class="kd"&gt;symbolic&lt;/span&gt; &lt;span class="kd"&gt;link&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="kd"&gt;Creating&lt;/span&gt; &lt;span class="kd"&gt;symbolic&lt;/span&gt; &lt;span class="kd"&gt;link&lt;/span&gt; &lt;span class="kd"&gt;to&lt;/span&gt; &lt;span class="nv"&gt;%newVersion%&lt;/span&gt;...
    &lt;span class="nb"&gt;mklink&lt;/span&gt; &lt;span class="na"&gt;/j &lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;%myNodeJSPath%&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;%myNVMPath%&lt;/span&gt;&lt;span class="s2"&gt;\v&lt;/span&gt;&lt;span class="nv"&gt;%newVersion%&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt;

&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="k"&gt;else&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"&lt;/span&gt;&lt;span class="nv"&gt;%newVersion%&lt;/span&gt;&lt;span class="s2"&gt;"&lt;/span&gt; &lt;span class="kd"&gt;version&lt;/span&gt; &lt;span class="kd"&gt;does&lt;/span&gt; &lt;span class="ow"&gt;not&lt;/span&gt; &lt;span class="ow"&gt;exist&lt;/span&gt;.
    &lt;span class="k"&gt;exit&lt;/span&gt; &lt;span class="na"&gt;/b &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;
&lt;span class="o"&gt;)&lt;/span&gt;

&lt;span class="c"&gt;:: Check if the mklink command was successful&lt;/span&gt;
&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="ow"&gt;errorlevel&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;
    &lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="kd"&gt;Failed&lt;/span&gt; &lt;span class="kd"&gt;to&lt;/span&gt; &lt;span class="kd"&gt;create&lt;/span&gt; &lt;span class="kd"&gt;symbolic&lt;/span&gt; &lt;span class="kd"&gt;link&lt;/span&gt;.
    &lt;span class="k"&gt;exit&lt;/span&gt; &lt;span class="na"&gt;/b &lt;/span&gt;&lt;span class="m"&gt;1&lt;/span&gt;
&lt;span class="o"&gt;)&lt;/span&gt; 

&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="kd"&gt;Operation&lt;/span&gt; &lt;span class="kd"&gt;completed&lt;/span&gt; &lt;span class="kd"&gt;successfully&lt;/span&gt;.
&lt;span class="nb"&gt;endlocal&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then configure bat file path into environment user variables.&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr6kqhlvcos4fkzbn80y8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fr6kqhlvcos4fkzbn80y8.png" alt="NVM4W path setup" width="628" height="53"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;And register NVM4W variable name into path field&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkn580m2de3bjiqa0f5a9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fkn580m2de3bjiqa0f5a9.png" alt="NVM4W path register" width="364" height="80"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;After setting up nvm4w path then open command prompt and run &lt;code&gt;nvm-use&lt;/code&gt; to check it working or not.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;PS: I'm open for questions, information, correction and new thoughts&lt;/em&gt;&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>nvm</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
