In this guide, we will install the following development tools
- Visual Studio Code
- nvm
- node
- npm
- tsc
This course has been tested with the following software versions:
- nvm 0.35.0
- npm 7.24.0
- node 16.10.0
- tsc 4.6.4
- Angular 14
- Spring Boot 2.7.1
It is highly recommended that you use the versions listed above to make sure you do not encounter any issues with the course. If you choose to use other versions then the code may not work as expected.
-
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: ...
-
If you are using Z shell (zsh), apply the new PATH settings with:
code ~/.zshrc
The
code
command will launch Visual Studio Code. -
Add the following content to the
.zshrc
fileexport NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
-
Save the file and exit the text editor.
-
Apply the changes with the following command
source ~/.zshrc
-
If you are using BASH shell, apply the new PATH settings with:
source ~/.bashrc
-
Update your
~/.bash_profile
file to reference your~/.bashrc
file.code ~/.bash_profile
The
code
command will launch Visual Studio Code. -
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 the 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 v18.4.0... Downloading https://nodejs.org/dist/v18.4.0/node-v18.4.0-darwin-x64.tar.xz... ######################################################################## 100.0% Computing checksum with shasum -a 256 Checksums matched! Now using node v18.4.0 (npm v8.12.1) Creating default alias: default -> node (-> v18.4.0)
-
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.
Note: This course has been tested with Node 16.10. We will install this version.
-
Install and use Node 16.10
nvm install 16.10.0 nvm use 16.10.0
tsc is the TypeScript compiler. We use tsc to compile TypeScript code into JavaScript code. We can install the TypeScript compiler using the Node Package Manager (npm)
Note: This course has been tested with TypeScript 4.6. We will install this version.
-
In your terminal window, enter the following command
npm install -g [email protected]
The
-g
installs this as a global package. The TypeScript compiler will be available to all directories for this user. -
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.
© 2022, luv2code LLC - All rights reserved.