- Building Enterprise JavaScript Applications
- Daniel Li
- 209字
- 2021-07-23 16:31:08
Installing Node
With that background on modules out of the way, let's begin the development of our application by installing Node.js on our local machine. Just like the saying "Many roads lead to Rome", there are many ways to install Node.js on your machine. You can do one of the following:
- Go to https://nodejs.org/ and download its source code (in the form of a *.tar.gz archive)
- Go to https://nodejs.org/ and download an installer
- Go to https://nodejs.org/en/download/package-manager/ and download the Node version that's listed on your operating system's package repository
But the easiest way is to use Node Version Manager (nvm), which has the added benefit of allowing you to download and switch between different versions of Node. This is especially handy if you're working on different Node projects at the same time, each using a different version.
There are several popular programs that manage the Node versions for you. nvm and nave manage Node versions per user/shell, which means different users on the same machine can use different versions of Node. There's also n, which manages the global/system-wide Node version. Lastly, nodenv can also be useful as it can automatically detect the correct version of Node to use for your project.