Normally, there's an ad running in this spot, but you're using an ad blocker. To help support our blog, which provides free tutorials for everybody, we just ask that you whitelist or follow us on facebook, twitter, or subscribe using the form to the leftabove. Thank you!

    Installing NodeJS for Programming

    Select Your OS:

    By the end of this tutorial, you'll have NodeJS and/or NVM installed and running on your local machine. We won't be going into JavaScript programming concepts. If you're looking to learn about JavaScript software development, head over to thisthis article after you have JavaScript installed.

    System requirements

    • A 32-bit or 64-bit computer with at least 8GB of RAM. 16GB or more is recommended.
    • At least 16GB of free disk space.

    Install NodeJS

    The following guide will install NodeJS to your local machine. This is the preferred way as some applications don't play nice with Node Version Manager. However, if you need multiple versions of NodeJS running on your computer and you need to switch back and forth, skip to the next section. Don't install both NodeJs and Node Version Manger. Choose one of the paths.

    ```bash
    sudo apt-get install python-software-properties
    curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
    sudo apt-get install nodejs
    
    node -v
    v6.11.3
    
    npm -v
    v3.10.10
    ```
    

    Install Node Version Manager

    ```bash
    # Run NVM installer
    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.4/install.sh | bash
    wget -qO- https://raw.githubusercontent.com/creationix/nvm/v0.33.4/install.sh | bash
    ```
    

    Install Homebrew from https://brew.sh/.

    ```bash
    # Install
    brew update
    brew install nvm
    mkdir ~/.nvm
    
    # Update bash_profile
    nano ~/.bash_profile
    
    # Copy and paste the following
    export NVM_DIR=~/.nvm
    source $(brew --prefix nvm)/nvm.sh
    
    # After you save and close bash_profile, run the following
    source ~/.bash_profile
    echo $NVM_DIR
    ```
    

    Run NVM Commands

    # Install current nodejs
    nvm install v6.11.3
    nvm alias default v6.11.3
    
    # Upgrade
    nvm reinstall-packages v8.5.0
    
    # Check which versions are install
    nvm ls
    
    # Deleting old versions
    nvm uninstall v6.11.3
    nvm uninstall v8.5.0
    

    Start the NodeJS REPL

    Test your NodeJS installation by typing node in your shell/terminal and hitting enter. If everything was installed successfully, you'll enter a NodeJS session and have the ability to execute python code.

    > 1 + 2
    3
    >
    

    Hit Ctrl+D to exit the NodeJS REPL.

    Did you like this tutorial? Help us pay for server costs by following us on Facebook, Twitter, and subscribing below, where you'll get post notifications, training webinar invites, and free bundles.