Operations 13 min read

How to Efficiently Develop Node.js, Go, and Rust in WSL with Minimal Setup

This guide shows how to set up a WSL environment that runs Node.js, Go, and Rust side‑by‑side by using fast version managers, lightweight package tools, shared directory layouts, VS Code extensions, and terminal workflows, all with concise configuration commands.

Ubuntu
Ubuntu
Ubuntu
How to Efficiently Develop Node.js, Go, and Rust in WSL with Minimal Setup

1. Node.js Development Environment

Version manager: Use fnm (Fast Node Manager), which is written in Rust and is claimed to be more than ten times faster than nvm.

# Install fnm
curl -fsSL https://fnm.vercel.app/install | bash

# Reload shell
source ~/.bashrc

# Verify installation
fnm --version

Common operations:

# Install LTS version
fnm install --lts
# Or install a specific version
fnm install 20
fnm install 22

# List installed versions
fnm list

# Switch version for the current project
fnm use 20
# Set global default version
fnm default 22

# Run a command with a specific version without switching
fnm exec 18 node -v

# Uninstall a version
fnm uninstall 16

Package manager: pnpm (installed via Corepack) is preferred for its speed, small disk footprint, strict dependency management, and built‑in workspace support.

# Enable Corepack and install pnpm
corepack enable
corepack prepare pnpm@latest --activate
# Or install globally via npm
npm i -g pnpm

# Verify installation
pnpm --version

Global tools (examples):

# Development tools
pnpm add -g typescript ts-node
pnpm add -g nodemon pm2
pnpm add -g @vue/cli create-next-app
pnpm add -g vite eslint prettier
pnpm add -g turbo nx

# Testing tools
pnpm add -g jest vitest

# Verify versions
tsc --version
nodemon --version

Project test: Create a Vite + React TypeScript project and run it.

# Create project
pnpm create vite my-react-app --template react-ts
cd my-react-app
pnpm install
pnpm dev
# Open http://localhost:5173 in a browser

2. Go Development Environment

Two installation methods are provided:

# Method 1: apt (may not be the latest)
sudo apt install -y golang-go
go version

# Method 2: official script (recommended for the latest version)
wget https://go.dev/dl/go1.22.0.linux-amd64.tar.gz
sudo rm -rf /usr/local/go
sudo tar -C /usr/local -xzf go1.22.0.linux-amd64.tar.gz
rm go1.22.0.linux-amd64.tar.gz

# Add to PATH in .bashrc
echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bashrc
echo 'export GOPATH=$HOME/go' >> ~/.bashrc
echo 'export PATH=$PATH:$GOPATH/bin' >> ~/.bashrc
source ~/.bashrc

# Verify installation
go version

Project structure example:

# Create project directory (outside GOPATH)
mkdir -p ~/projects/hello-go && cd ~/projects/hello-go

# Initialise module
go mod init hello-go

# Write a simple program
cat > main.go << 'EOF'
package main

import "fmt"

func main() {
    fmt.Println("🎉 Hello from Go on WSL!")
}
EOF

# Run the program
go run main.go

# Build a binary
go build -o hello-go ./...
./hello-go

Common Go toolchain commands:

# Formatting and static analysis
go fmt ./...
go vet ./...
go install golang.org/x/tools/cmd/gopls@latest

# Testing
go test ./...
go test -v -race ./...

# Profiling
go tool pprof

# Dependency management
go mod tidy
go mod download
go mod graph

3. Rust Development Environment

Install the official toolchain manager rustup:

# Run the official installation script
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# Accept the default option (press 1 and Enter)
# Expected output: stable-x86_64-unknown-linux-gnu installed - rustc 1.x.y

Typical post‑install steps:

# Reload shell
source ~/.cargo/env

# Verify versions
rustc --version   # Rust compiler
cargo --version   # Package manager / build tool
rustup --version  # Version manager

# Install useful components
rustup component add clippy      # Lint checks
rustup component add rustfmt     # Code formatting
rustup component add rust-analyzer # VS Code LSP
rustup component add rust-src     # Source for IDE navigation

# Switch toolchain channel
rustup default stable   # Stable release
rustup default nightly  # Latest features

# Add cross‑compilation targets
rustup target add wasm32-wasi   # WebAssembly
rustup target add aarch64-unknown-linux-gnu   # ARM64 Linux

Cargo ecosystem quick start:

# Initialise a new project
cargo new my-rust-app && cd my-rust-app
cargo run   # Build and run

# Common cargo sub‑commands
cargo check          # Fast syntax check (no binary)
cargo build --release
cargo test
cargo bench
cargo doc
cargo clippy
cargo fmt

# Useful global tools
cargo install bacon       # Real‑time code review
cargo install cargo-edit  # Enhanced add/remove
cargo install cargo-watch # Auto‑run on file changes
cargo install cargo-audit # Security audit

Example CLI tool:

# Create a new CLI project
cargo new greet-cli && cd greet-cli

# Write source (src/main.rs)
cat > src/main.rs << 'EOF'
use std::env;

fn main() {
    let args: Vec<String> = env::args().collect();
    let name = args.get(1).map(|s| s.as_str()).unwrap_or("World");
    println!("Hello, {}! 👋 Welcome to WSL!", name);
}
EOF

# Run the CLI
cargo run -- -- Rust
# Expected output: Hello, Rust! 👋 Welcome to WSL!

4. Multi‑Language Co‑existence Tips

Unified directory layout:

~/projects/
├── web-frontend/   # Node.js / TypeScript
├── api-server/     # Go backend
├── data-pipeline/  # Python data processing
├── cli-tool/       # Rust command‑line tool
└── shared-proto/   # Shared protocol definitions

Shared shell configuration (example snippets for ~/.bashrc ):

# Project quick‑jump aliases
alias pj='cd ~/projects'
alias ws='pj && ls -1'

# Language‑specific run helpers
run_node() { (cd "$1" && pnpm dev); }
run_go()   { (cd "$1" && go run .); }
run_python(){ (cd "$1" && source .venv/bin/activate && python3 "$2"); }

# Git shortcuts
alias gs='git status'
alias gl='git log --oneline -10'
alias gp='git push'

# Docker shortcuts
alias dc='docker compose'
alias dps='docker ps --format "table {{.Names}}	{{.Status}}	{{.Ports}}"'

VS Code extensions for a seamless experience:

Pylance – Python intelligent completion and type checking

Go (golang.Go) – Debugging, testing, and navigation for Go

rust-analyzer – Completion, diagnostics, and code actions for Rust

ESLint – Linting for JavaScript/TypeScript

Error Lens – Inline error display for all languages

Terminal multi‑tab workflow (Windows Terminal example):

Tab 1: ~/projects/api-server   (Go development)
Tab 2: ~/projects/web-frontend (Frontend hot‑reload)
Tab 3: ~/projects/data-pipeline (Python data work)
Tab 4: ~                         (General ops / Docker)

Each tab runs an independent WSL shell, keeping environments isolated.

5. Quick Comparison Summary

Version managers: Node.js uses fnm; Go relies on manual version handling; Rust uses rustup.

Package managers: Node.js – pnpm / npm; Go – go mod; Rust – cargo.

Project scaffolding: Node.js – pnpm create …; Go – go mod init; Rust – cargo new.

Dependency files: package.json & pnpm-lock.yaml (Node); go.mod & go.sum (Go); Cargo.toml & Cargo.lock (Rust).

Isolation: Node.js uses node_modules/; Go and Rust rely on module caches.

Build artifacts: Node.js – dist/; Go – native binaries; Rust – native binaries.

Startup speed: Node.js – fast (JIT); Go – extremely fast (native); Rust – compile‑time heavy but runtime extremely fast.

Typical use cases: Node.js – web front‑end/back‑end; Go – cloud‑native microservices; Rust – CLI tools, system programming, WebAssembly.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

RustGoNode.jsDevelopment EnvironmentpnpmWSLfnmrustup
Ubuntu
Written by

Ubuntu

Focused on Ubuntu/Linux tech sharing, offering the latest news, practical tools, beginner tutorials, and problem solutions. Connecting open-source enthusiasts to build a Linux learning community. Join our QQ group or channel for discussion!

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.