In 2023, Node.js continues to be a game-changer in the world of web development, and for Windows users, harnessing its potential efficiently is more crucial than ever. Whether you're a seasoned Node.js developer or just embarking on your coding journey, this post is your essential guide to mastering Node.js on the Windows platform. We'll delve into the tools and tricks that can enhance your development experience, making it smoother and more productive. Get ready to turbocharge your Node.js journey and make the most of your Windows environment!
Windows Subsystem for Linux 2 (WSL 2) is a technology that allows you to run a full Linux kernel on your Windows machine. It offers improved performance and compatibility compared to its predecessor, WSL 1, making it a valuable tool for developers who need to work with Linux-based software on their Windows systems. WSL 2 seamlessly combines the Windows and Linux environments, providing a versatile solution for development tasks.
To install it open the Windows Powershell and run:
After installing reboot your PC.
Remember to enable virtualization on your BIOS.
Now open the Microsoft Store and search for Ubuntu(or any other Linux distro supported by WSL), click on install.
Windows Terminal is a modern and powerful command-line interface for Windows that offers a more versatile and user-friendly experience for developers and system administrators. It consolidates various command-line tools, shells, and scripts into a single application, enabling you to work with PowerShell, Command Prompt, and even Linux distributions through WSL.
Search on Microsoft Store and install it (maybe it is already on your system).
Zsh, short for Z Shell, is a highly customizable and powerful command-line shell that serves as an excellent alternative to the default shells like Bash or PowerShell. With a user-friendly and feature-rich environment, Zsh is popular among developers and power users for its extensive plugin support, auto-completion, and a plethora of productivity-enhancing features.
Now we are in a Linux! Maybe it take a while for the first time, then will ask you for a username and a password. When finished we will see or prompt ready, let's install the ZSH and OMZ:
sudo apt install zsh
When ask for your password type it and hit enter.
Now install the OMZ:
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
The script will ask to change the default shell, type "y" and hit enter.
We need some custom font to use with our shell theme, the new font will support some "icons" to improve the experience (really?).
You can get one here, I recommend the Cascadia Code.
After downloading, extract it and double-click to install.
Starship is a sleek and highly customizable command-line prompt that enhances your shell experience by providing a visually appealing and informative prompt. It's designed to work with various shells, including Bash, Zsh, Fish, and PowerShell, and offers a wide range of features to make your command-line interactions more efficient and enjoyable.
To install run this command:
curl -sS https://starship.rs/install.sh | sh
Type "y" and hit enter when asked, after:
eval "$(starship init zsh)"
Now you can get a preset or a theme or even create one, just check the documentation here
Let's install Node.js but we will use the
nvm, which is a Node version manager, so you can install any version of Node.js with no problems or conflicts.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.5/install.sh | bash
Now, to install the LTS version:
nvm install --lts
Change "--lts" for a specific version number if you want
Now you are ready to go! Pick your favorite code editor and go on!
I recommend the Visual Studio Code cause it has an awesome integration with WSL system.