In this tutorial, we will show you how to set the environment variable path in Windows 11 | 10 for node js or npm.
Here are two approaches to add or set node js or npm path to the system environment variable in Windows:
Approach 1: Add Node Js Path using GUI
Set the node js or npm path to the system environment variable by using GUI:
Step 1 – Open the Start menu and search for “Environment Variables”.
First of all, visit your system bottom search bar and search Environment Variables; as shown below picture:
Step 2 – Environment Setting
Then Click on the environment variable setting; as shown below picture:
Step 3 – Edit System Environment Variable Path
Edit system environment variable path; as shown below picture:
Step 4 – Set Node js or Npm path
Click the “New” button and add the following paths (or similar paths depending on your installation):
- For Node.js: C:\Program Files\nodejs\node_modules.bin
- For NPM:
C:\Users\<YourUsername>\AppData\Roaming\npm
Make sure to replace <YourUsername>
with your actual Windows username.
Click “OK” to close the “Edit environment variable” dialog, “OK” again to close the “Environment Variables” dialog, and one last “OK” to close the “System Properties” dialog.
Step 5 – Restart Windows 11|10
Restart windows 10/11 system.
Approach 2: Set Node js Path using Command Line OR Prompt
Set node js or npm path to the system environment variable using command prompt or line:
Step 1 – Open Command Prompt
First of all, visit your system bottom search bar and search cmd and then click on cmd to start your command prompt.
Step 2 – Set Node JS Path to Environment Variable
Once you have started your command prompt. Next run the following command into it to set node js path to system environment in windows:
setx path "%PATH%;C:\Program Files\nodejs"
After running this command, you will see success message into your command prompt.
Step 3 – Restart Windows 11|10
Restart the Windows 10/11 system.
Conclusion
Through this tutorial, we have learned how to set node js npm path to a system environment variable in Windows 11/10.