JavaScript

How to resolve the “node is not recognized as an internal or external command ” error?

Node.js is a powerful run-time environment based on Google’s v8 engine that is responsible for making fast and scalable web applications like streaming, chat apps, browser games, command-line applications, and much more. However, as a programmer, you cannot escape from errors. One such error based on Node.js is shown in the below screenshot:

You can see we are encountering node is not recognized as an internal or external command error.

Error Causes

Two of the main reasons due to which you can encounter the above-mentioned error are:

  • Node.js is not installed on your system
  • Environment variables are incorrectly set

Install Node.js

To properly install Node.js, open your favorite browser and visit the official Node.js website. Click on the windows installer shown in the below screenshot.

Your Node.js installer will start downloading and once the downloading finishes, navigate to your downloads folder and click on the Node.js installer. Keep on clicking the Next button until your Node.js gets successfully installed.

To verify installation open cmd on your system and execute the below command:

$ node -v

Set Environment Variables

Sometimes even after successful installation of Node.js, the error keeps on appearing; this is because the environment variable is not set properly. To set the environment variable, simply search for edit the system environment in the search bar at the below-left corner of Windows 10.

Click on the edit system environment variables, a window will open where you have to click on Environment Variables.

The Environment Variables window will open where you have to select or double click on the variable Path.

Now paste the complete path where Node.js was installed. Click on ok and restart your system.

You can find the path of Node.js by searching node in the search bar located at the left bottom corner of windows 10.

You’ll see the node application, right-click on the node application and then click on an open file location.

The file location of Node.js will open and you have to copy the path shown in the below screenshot:

Once done, open the command prompt and execute the below-mentioned command again:

$ node -v

You will see the Node.js version installed on your system and the error has been terminated.

Conclusion

The server-side platform for generating web applications and web pages is Node.js. Node.js may easily be used as a server-side proxy, allowing it to manage a huge number of simultaneous connections while being non-blocking. It’s very useful for proxying numerous services with different response times or gathering data from various sources.

You may encounter the error of node is not recognized as an internal or external command when you run commands in your visual studio code editor or any other editor. In this post, we provided two methods by which you can resolve the “node is not recognized as an internal or external” error that is properly installing Node.js and the second method was to set the environment variable path.

About the author

Shehroz Azam

A Javascript Developer & Linux enthusiast with 4 years of industrial experience and proven know-how to combine creative and usability viewpoints resulting in world-class web applications. I have experience working with Vue, React & Node.js & currently working on article writing and video creation.