In this guide, we will install the following development tools
- Visual Studio Code
- nvm
- node
- npm
- tsc
-
git: You must have the git command-line tool installed.
- To install git, visit: https://git-scm.com/
Visual Studio Code is a general purpose IDE that support many programming languages. Visual Studio code has built-in support for TypeScript.
-
In a web browser, visit https://code.visualstudio.com/
-
Follow the link to download Visual Studio Code for Mac
-
Unzip the downloaded file
-
Move the Visual Studio Code app to your Applications Folder
-
In your Applications Folder, start the Visual Studio Code app
nvm is the Node Version Manager. It allows you to install multiple versions of Node on your computer. Once installed, then you can easily switch to a different version of Node. This is very useful if you want to develop/test using different versions of Node. When you are developing multiple projects, you will most likely need to support different versions of Node.
The best feature of nvm is that it makes the installation of Node very easy for Mac and Linux system. Historically, to install Node on Mac/Linux, you would have to make frequent use of the "sudo" command to elevate privileges. This was a painful and clunky process during development. Thanks the nvm, we no longer have to use "sudo" when using Node.
Also, the Node ecosystem is a fast moving target and versions change frequently. nvm makes it easy to stay up to date with the latest version of Node.
The website for nvm is: https://github.com/nvm-sh/nvm
Note: You must have git installed before running this script.
-
Open a new terminal window
-
Enter the following commands:
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.35.0/install.sh | bash
The script clones the nvm repository to
~/.nvm
and adds the source line to your profile:~/.bashrc
.You will see output similar to the following:
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 13527 100 13527 0 0 62065 0 --:--:-- --:--:-- --:--:-- 62336 => Downloading nvm from git to '/Users/luv2code/.nvm' => Cloning into '/Users/luv2code/.nvm'... remote: Enumerating objects: 286, done. ... => Appending nvm source string to /Users/luv2code/.bashrc => Appending bash_completion source string to /Users/luv2code/.bashrc => Close and reopen your terminal to start using nvm or run the following to use it now: ...
-
Apply the new PATH settings with:
source ~/.bashrc
-
Update your
~/.bash_profile
file to reference your~/.bashrc
file. Open the file in VS Code.The
code
command will launch Visual Studio Code.code ~/.bash_profile
-
Your
.bash_profile
file should now be open in Visual Studio Code. -
Add the following text to your
.bash_profile
file:if [ -r ~/.bashrc ]; then source ~/.bashrc fi
-
Save your
bash_profile
file and exit Visual Studio Code. -
Move back to your terminal window.
-
Verify the installation by typing the following command:
nvm --version
If the installation is successful, you will see the version number.
For details on other nvm commands, use
nvm --help
or see the docs: https://github.com/nvm-sh/nvm
Node is the the runtime environment for executing JavaScript code from the command-line. By using Node, you can create any type of application using JavaScript including server-side / backend applications.
In this course, we'll use Node to run applications that we develop using TypeScript and Angular.
-
In your terminal window, type the following command:
nvm install node
You will see the following output
Downloading and installing node v12.11.1... Downloading https://nodejs.org/dist/v12.11.1/node-v12.11.1-darwin-x64.tar.gz... ######################################################################## 100.0% Computing checksum with shasum -a 256 Checksums matched! Now using node v12.11.1 (npm v6.11.3) Creating default alias: default -> node (-> v12.11.1)
-
Verify the node installation
node --version
If the installation is successful, you will see the version number
Note: The Node installation also includes npm (Node Package Manager).
-
Verify npm is installed
npm --version
If the installation is successful, you will see the version number.
Note: node will have a different number than npm. This is similar to a different Java JDK version number compared to Maven version number.
In this example, node is similar to the Java JDK. And npm is similar to Maven.
tsc is the TypeScript compiler. We use tsc to compile TypeScript code into JavaScript code. We can install the TypeScript compile using the Node Package Manager (npm)
-
In you terminal window, enter the following command
npm install -g typescript
The
-g
installs this as a global package. The TypeScript compiler will be available to all directories for this user.You will see something similar to
/Users/luv2code/.nvm/versions/node/v12.11.1/bin/tsc -> /Users/luv2code/.nvm/versions/node/v12.11.1/lib/node_modules/typescript/bin/tsc /Users/luv2code/.nvm/versions/node/v12.11.1/bin/tsserver -> /Users/luv2code/.nvm/versions/node/v12.11.1/lib/node_modules/typescript/bin/tsserver + typescript@3.6.3 added 1 package from 1 contributor in 1.526s
-
You can verify the installation
tsc --version
If the installation is successful, you will see the version number.
That's it! You have successfully installed the development tools: Visual Studio Code, nvm, node, npm and tsc.
© 2020, luv2code LLC - All rights reserved.