DEV Community

Tulio Calil
Tulio Calil

Posted on

Node.Js on Windows in 2023 - Tools and tricks

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!

WSL 2

Image description

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:

wsl --install
Enter fullscreen mode Exit fullscreen mode

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.

Image description

Windows Terminal

Image description

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).

Oh My Zsh

Image description

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.

To install it, open the Windows terminal click on the dropdown arrow, and select Ubuntu.
Image description

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
Enter fullscreen mode Exit fullscreen mode

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)"
Enter fullscreen mode Exit fullscreen mode

The script will ask to change the default shell, type "y" and hit enter.

Shell font

Image description

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

Image description

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
Enter fullscreen mode Exit fullscreen mode

Type "y" and hit enter when asked, after:

eval "$(starship init zsh)"
Enter fullscreen mode Exit fullscreen mode

Now you can get a preset or a theme or even create one, just check the documentation here

Node.js

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

source ~/.zshrc
Enter fullscreen mode Exit fullscreen mode

Now, to install the LTS version:

nvm install --lts
Enter fullscreen mode Exit fullscreen mode

Change "--lts" for a specific version number if you want

Conclusion

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.

Top comments (0)