Day 1: Error During Node.js Installation - Error : `node: command not found`

Dipak Ahirav - Jul 3 - - Dev Community

Cause: This error occurs when Node.js is not properly installed on your system or the path is not correctly set.

please subscribe to my YouTube channel to support my channel and get more web development tutorials.

Solution:

Step-by-Step Solution

  1. Download Node.js:

    • Visit the official Node.js website.
    • Choose the appropriate installer for your operating system (Windows, macOS, or Linux).
    • Download the installer and follow the on-screen instructions to install Node.js.
  2. Verify Installation:

    • Open your terminal (Command Prompt on Windows, Terminal on macOS/Linux).
    • Run the following command to check if Node.js is installed correctly:
     node -v
    
  • If Node.js is installed, this command will display the version of Node.js installed. For example, v16.0.0.
  1. Setting the Path (if the above steps don’t work):
  • For Windows:

    1. Open the Start menu and search for Environment Variables.
    2. Click on Edit the system environment variables.
    3. In the System Properties window, click on the Environment Variables button.
    4. Under System variables, find the Path variable and click Edit.
    5. Click New and add the path to the Node.js installation directory. For example, C:\Program Files\nodejs\.
    6. Click OK to save the changes and close all windows.
    7. Restart your Command Prompt and verify the installation again with:

      node -v
      
  • For macOS/Linux:

    1. Open your terminal.
    2. Open your shell profile file in a text editor (.bashrc, .bash_profile, .zshrc, etc. depending on your shell):

      nano ~/.bashrc
      
 3. Add the following line to the file to include the Node.js installation directory in your PATH:
Enter fullscreen mode Exit fullscreen mode
    ```bash
    export PATH=$PATH:/usr/local/bin/node
    ```
Enter fullscreen mode Exit fullscreen mode
 4. Save the file and reload the changes with:
Enter fullscreen mode Exit fullscreen mode
    ```bash
    source ~/.bashrc
    ```
Enter fullscreen mode Exit fullscreen mode
 5. Verify the installation again with:
Enter fullscreen mode Exit fullscreen mode
    ```bash
    node -v
    ```
Enter fullscreen mode Exit fullscreen mode

This should resolve the node: command not found error and successfully install Node.js on your system.

please subscribe to my YouTube channel to support my channel and get more web development tutorials.

Follow and Subscribe:

Happy coding! 🚀

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Terabox Video Player