Every tutorial starts with "just install Node and you're ready to build!" Yeah, that's complete horseshit. Here's what actually works after you've burned through three different Node versions and questioned your career choices.
Node.js Version Hell
Use Node.js 22.x LTS - period. This is now required for Hardhat 3.x (released in 2025). Don't use 20.x (deprecated for newer Hardhat), don't use 24.x (bleeding edge), and definitely don't use whatever Ubuntu's package manager gives you by default.
## Install nvm first if you don't have it
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
source ~/.bashrc
## Install and use Node 22
nvm install 22
nvm use 22
nvm alias default 22
Why this matters: Wasted 3 hours of my life on "Module not found" errors that had nothing to do with actual missing modules. Turned out Node 20.x was the problem - switched to 22.11.1 and boom, suddenly I'm a genius again. Hardhat 3.x apparently has strong opinions about Node versions. Ignore this, enjoy your weekend of phantom errors.
Git Configuration That Won't Break
Your Git config needs to handle large repos because Polygon's dependencies are massive:
git config --global http.postBuffer 524288000
git config --global core.compression 0
git config --global pack.windowMemory 256m
The Actual Development Stack
Here's what you need installed, in this exact order:
- Node.js 22.x LTS (covered above)
- Yarn or npm - doesn't matter which, just pick one and stick with it
3. MetaMask - but configured correctly (we'll cover the network fuckery later)
4. Hardhat - the least broken development framework for Polygon
5. VS Code extensions - Solidity, Hardhat for Visual Studio Code
System Requirements That Actually Matter
- 16GB RAM minimum - Hardhat compilation will eat 8GB easily
- 50GB free disk space - node_modules folders are cancer
- Stable internet - you'll be downloading GB of dependencies
Windows users: Use WSL2. Don't try to develop directly on Windows. You'll waste days fighting path issues and permission errors. The official Microsoft guide actually works.
Mac users: Install Homebrew first, then use it for everything. Package manager conflicts will ruin your life otherwise.
Linux users: You probably know what you're doing, but check your Node installation isn't the system package - use nvm instead.
Environment Variables Setup
Create a .env
file in your project root. This template handles the common gotchas:
## Never commit this file to Git
PRIVATE_KEY=your_private_key_here
POLYGON_RPC_URL=https://polygon-rpc.com/
POLYGONSCAN_API_KEY=your_api_key_here
## For local development
LOCALHOST_RPC_URL=http://127.0.0.1:8545
## Gas settings (adjust based on network congestion)
GAS_LIMIT=2000000
GAS_PRICE=30000000000
Learn from someone else's expensive mistake: Dev wallets only. Never, ever your real wallet. Watched a teammate commit his production private key to our public repo. By the time anyone noticed the bot alerts, $12K was gone. Took exactly 4 minutes. Don't be that guy.
Essential Resources
- Official Node.js Downloads - Always use the latest LTS version
- Node Version Manager (nvm) - Essential for managing multiple Node versions
- Git Configuration Guide - Official Git setup documentation
- WSL2 Installation Guide - Microsoft's official Windows Linux subsystem guide
- Homebrew Package Manager - The missing package manager for macOS
- MetaMask Official Documentation - Complete wallet integration guide
- Polygon Developer Documentation - Official developer resources
- Hardhat Documentation - Complete development environment guide
- Environment Variables Best Practices - The twelve-factor app methodology
- GitHub Security Best Practices - Avoiding private key commits
- Polygon Gas Station - Real-time gas price monitoring
- Solidity VS Code Extension - Essential Solidity development support
The One Command That Fixes Everything
When shit breaks (and it will), this nuclear option usually fixes it:
## Delete everything and start fresh
rm -rf node_modules package-lock.json yarn.lock
npm cache clean --force
npm install
This works for 80% of "mysterious" build failures. Keep this command handy - you'll use it more than you want to admit.