Installing Node.js in WSL2
Node.js is a popular JavaScript runtime environment, and can be used for both backend and frontend development. In this chapter we'll be using it for frontend development; it will manage our library dependencies, compile and check our code, and provide modern developer tools that will help us build applications.
We'll be installing Node.js on Ubuntu, under WSL2. While Node.js development is perfectly possible on Windows and PowerShell, it can lead to dependency headaches with packages like node_gyp
and SASS. By using WSL2, we'll avoid these issues, and demonstrate how to develop with Windows Terminal and WSL2. The patterns we cover here will extend to developing in other programming languages on WSL2 as well. In Chapter 12, Building REST APIs with C# and Windows Terminal, we'll cover a Windows and PowerShell development workflow with Windows Terminal.
While Node.js is available in the standard Ubuntu package repositories, it tends...