In this article, you will learn about how to fix node is not recognized.

If you ever faced a problem like “node is not recognized as an internal or external command” after installing node.js. Don’t worry! It’s a common problem and its solution is very easy.

You may face this kind of unwanted situation because of not setting the path of the node as an environment variable. Let me show you the solution of it in the following steps:

Step 1:

For the first step, you have to open the control panel and then click on the system & security from there click on system and then advanced system settings, and finally environment variables.

You will get an interface like at the picture when you follow these steps Open control panel—>system & security—> system—>advanced system settings—>environment variable.

Step 2:

In this step, when you click on environment variables a new dialog box will open in front of you. One is user variables and another is system variables. In there click on PATH and then click on edit button. Another dialog box will open for you and there click on new and set C:\Program Files\nodejs this as nodejs address.

Node is not recognized

After setting up PATH you have to click ok from all the dialog boxes.

Step 3:

In this step, you have to do one final thing and that is you have to restart your code editor or computer and open a fresh command-line interface. After doing so, if you write node again in the command line your problem will be solved.

Node is not recognized

Note: The version of nodejs may be different based on the period of time you install Nodejs into your computer.

There’s an alternative way of solving this issue by using the command line.

All you need to do is write this command in the command line SET PATH=C:\Program Files\Nodejs;%PATH%

Note: Make sure that your command line console is running as an administrator. If your problem is not resolved try the following ways.

Reinstall Node.js

Sometimes, a corrupted installation of Node.js can cause this error. In such cases, the best solution is to uninstall Node.js completely and then reinstall it. Make sure to restart your computer after uninstalling before reinstalling it.

Check your system’s PATH variable

The PATH variable is an environment variable that lists the directories that your system searches when you run a command. Make sure that the path to the Node.js executable file is added to the PATH variable.

To check the PATH variable, open the command prompt and type "echo %PATH%". This will show you the directories listed in the PATH variable. If the path to the Node.js executable is not there, add it manually.

Use a package manager

If you’re using a package manager like NPM or Yarn, try installing Node.js through them. These package managers usually set the PATH variable automatically, so you don’t have to worry about it.

Update your system

Sometimes, an outdated operating system can cause issues with Node.js. Make sure that your operating system is updated to the latest version.

Run the command prompt as an administrator: In some cases, the error can occur due to permission issues. Running the command prompt as an administrator can fix this issue.