# Node.js

  • Ensure that a terminal (we prefer Git Bash) and Node.js are installed on your machine

# Git Bash

  • Git Bash is a terminal application that provides (among others) a BASH emulation to run Git from the command line
    • The BASH emulation behaves just like the git command in LINUX and UNIX environments
  • Git Bash is part of the Git for Windows (opens new window) package
  • To check your version of Git for Windows, open a new Git Bash window and enter git --version
$ git --version
git version 2.39.1.windows.1
1
2

TIP

If Git is already installed, you can update Git directly from within the terminal:

$ git update-git-for-windows
1

# Node.js

  • Node.js is an open source server environment build on Chrome's V8 JavaScript engine
  • Node.js is free and runs on various platforms (Windows, Linux, Unix, Mac OS X)

# Install node.js

  • Go to https://nodejs.org/en/ (opens new window)
  • Download and install the latest LTS version (the left one) of Node
    (Node updates almost weekly. By the time you read this, there is probably already a newer version available ...)

Install node.js

  • Follow the default settings when you install Node
  • To check your version, open a new Git Bash window and enter: node --version or node -v
$ node -v
v18.14.0
1
2

REMARKS

  • In this course we don't write node scripts ourselves
  • We only use ready-made scripts like gulp and live-server
  • Besides node.js, two other packages have been installed:
    • npm: or the node package manager for installing one of the 1.3 million open source packages (opens new window) for node
    • npx: or the node package runner for running (executing) a locally installed package, which is beyond the scope of this course

# Install gulp-cli

  • Gulp is a toolkit for automating painful or time-consuming tasks in your development workflow, so you can stop messing around and really build something 😉
    • We will use gulp later on in this course (ES6, jQuery, ...)
  • Install gulp-cli globally (i.e., such that it can be used in every folder/project on your computer):
    • open a terminal window and enter npm i -g gulp-cli
    • open a new Git Bash window and enter: gulp --version or gulp -v
$ gulp -v
CLI version: 2.3.0
Local version: Unknown
1
2
3

# Install live-server

  • Live-server is a development server with live reload capability for HTML, CSS and JavaScript and files
  • Live-server only works for static sites (not for PHP, ...)
  • Install live-server globally:
    • open a terminal window and enter npm i -g live-server
    • open a new Git Bash window and enter: live-server --version or live-server -v
$ live-server -v
live-server 1.2.2
1
2
  • Browse to the folder where your static site is stored and enter live-server, e.g.

live-server

TIP

You can run multiple live servers simultaneously by setting different ports for each website
-   `live-server` uses the default port 8080: `http://127.0.0.1:8080`
-   `live-server --port=3000` uses port 3000: `http://127.0.0.1:3000`
Last Updated: 2/9/2023, 11:17:24 AM