Set up your environment
Install Node.js, choose a package manager and configure an editor that helps instead of getting in the way.
Updated
A good setup removes friction before it starts. This lesson installs the three tools used throughout Strata: Node.js to run JavaScript outside the browser, a package manager to install libraries, and an editor that catches mistakes as you type.
What you will install
Install Node.js
Use a version manager rather than a system installer. It lets each project use the Node.js version it needs and keeps everything inside your home folder, which avoids permission problems later.
Step 1: Install a version manager
fnmis fast and works on macOS, Linux and Windows. On Windows, install it withwinget install Schniz.fnminstead of the script below.Terminal curl -fsSL https://fnm.vercel.app/install | bashStep 2: Install the current LTS release
Long term support releases receive security fixes for about three years, which makes them the right default for learning and for production.
Terminal fnm install --lts fnm default lts-latestStep 3: Check that it works
Open a new terminal window so it picks up the updated path, then print both versions.
Terminal node --version npm --version
Choose a package manager
npm ships with Node.js and is a perfectly good choice. pnpm saves disk space by sharing packages between projects, yarn is common in established codebases, and bun is an all in one runtime with a very fast installer. The commands map almost one to one, so pick whichever you like.
npm create vite@latest my-app
cd my-app
npm install
npm run devSet up your editor
Install Visual Studio Code, then add three extensions from the Extensions panel. Together they catch bugs early and keep formatting out of code reviews.
- ESLint underlines likely bugs, such as unused variables or missing dependencies in React hooks, while you type.
- Prettier formats every file the same way when you save it.
- Error Lens prints errors and warnings at the end of the line that caused them.
Workspace settings live in a .vscode folder inside the project, so everyone on the team gets the same behavior.
{
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"files.trimTrailingWhitespace": true
}Verify everything with a script
Create a file called check.mjs with the code below and run it with Node.js. If you see a version number and Ready to go, your machine is ready for the JavaScript track.
import os from 'node:os'
const [major] = process.versions.node.split('.').map(Number)
console.log(`Node.js ${process.version} on ${os.platform()}`)
console.log(major >= 20 ? 'Ready to go.' : 'Please upgrade to Node.js 20 or newer.')node check.mjs
# Node.js v22.12.0 on darwin
# Ready to go.Summary
- Install Node.js through a version manager, and use the LTS release.
- Any package manager works; the commands map almost one to one.
- Let your editor format on save and show lint errors inline.
- If a global install asks for
sudo, fix the installation rather than the command.
Finished this lesson?
Mark it complete to track your progress across every track in the curriculum.