Setup Nodejs and npm - spaceshiptrip/raspberrypi GitHub Wiki

  1. Find the current version of nodejs LTS --> https://nodejs.org/en/about/releases/
  2. At the time of writing, current LTS version was 15. Your mileage may vary.
  3. curl it down:
    curl -sL https://deb.nodesource.com/setup_15.x | sudo bash -
    
  4. Once the repository is enabled, install Node.js and npm by typing:
    sudo apt-get install -y nodejs
    
  5. Clean up - Recommended:
    sudo apt autoremove
    
  6. From their installation instructions:
    ## Run `sudo apt-get install -y nodejs` to install Node.js 15.x and npm
    ## You may also need development tools to build native addons:
      sudo apt-get install gcc g++ make
    ## To install the Yarn package manager, run:
      curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
      echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
      sudo apt-get update && sudo apt-get install yarn
    
  7. Install forever.js
https://www.npmjs.com/package/forever