Last updated: Apr 4, 2024
Reading time·4 min
The error "'node' is not recognized as an internal or external command, operable program or batch file" occurs for 2 main reasons:
PATH
environment variable.'node' is not recognized as an internal or external command, operable program or batch file The term 'node' is not recognized as the name of a cmdlet, function, script file, or operable program.
To install Node and add it to your PATH
environment variable:
Next
on the Welcome screen.Next
.Next
.Next
. Notice that there is an "Add to
PATH" option selected.Next
.Install
button.Finish
button.Make sure to close any existing command prompts and PowerShell instances for
the PATH
variable to get updated.
You can start a new CMD shell and use the node --version
command to make
sure Node is installed.
node --version
node
commands for the PATH variable to update.If you got the error in Visual Studio Code and restarting VSCode doesn't help, try to click on the trash bin button to restart the terminal.
If the error persists, add Node to your PATH environment variable manually.
To add Node to your PATH environment variable:
nodejs
directory is most likely under:C:\Program Files\nodejs
C:\Program Files (x86)\nodejs
node.exe
(executable) file.Next, ensure you also have the path to your npm directory in the PATH as well.
Your npm
directory is most likely located under
%USERPROFILE%\AppData\Roaming\npm
, which is the same as
C:\Users\YOUR_USER\AppData\Roaming\npm
.
%USERPROFILE%\AppData\Roaming\npm # 👇️ same as below (make sure to replace YOUR_USER) C:\Users\YOUR_USER\AppData\Roaming\npm
If you can't find it, try running the npm config get prefix
command.
npm config get prefix
Add the path to npm
and click on "OK" twice to confirm.
Close your Command prompt application and then reopen it.
You might also have to restart your PC, but that's not always necessary.
You can start a new CMD shell and use the node --version
command to make sure
Node is installed and configured properly.
node --version
If you got the error in Visual Studio Code and restarting VSCode doesn't help, try to click on the trash bin button to restart the terminal.
If the error persists, try to run CMD or VSCode as an administrator before
issuing a node
command.
To open CMD as an administrator:
Click on the Search bar and type CMD.
Right-click on the Command Prompt application and click "Run as administrator".
You can run VSCode as an administrator by right-clicking on VSCode and clicking "Run as administrator".
Try to issue a node
command with elevated permissions, e.g. node --version
.
To solve the error "'node' is not recognized as an internal or external command, operable program or batch file", make sure:
You can learn more about the related topics by checking out the following tutorials: