Learn TypeScript 3 by Building Web Applications
上QQ阅读APP看书,第一时间看更新

Windows

Go to the official website of Node.js: https://nodejs.org and download the latest LTS (short for Long Term Support) release; you'll find the download links directly on the home page. This is preferred at work, but you may also install the latest and greatest.

For this book, we will be using 8.12.0 LTS, but newer versions should be okay.

Once downloaded, run the installer as follows:

  1. On the first screen, select where to install and click on Next:

On the next screen, make sure that npm package manager is selected so that npm gets installed as well.

  1. Also, check that Add to PATH is selected:
  1. On the next screen, click on Install:

The installation should then get going:

  1. Once completed, click on Finish:

Congratulations, you now have both node and npm on your machine.
In addition, Node.js also comes with a pre-configured shell called Node.js:

If you open up Command Prompt (for example, with cmd.exe), then you should be able to execute node and npm and retrieve their respective versions:

C:\Users\username>node --version
v8.12.0

C:\Users\username>npm
5.8.0

It should also work fine within PowerShell if you prefer that:

PS C:\Users\username>node --version
v8.12.0

PS C:\Users\username>npm --version
5.8.0

The exact version numbers don't matter that much as this evolves all the time, but if you want to be sure to have the exact same behavior, then you can try to match ours.