Skip to content
GS-02Beginner3 min read

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

ToolWhy you need itVersion
Node.jsRuns JavaScript on your machine and powers nearly all front end tooling22 LTS or newer
A package managerInstalls, updates and removes the libraries a project depends onnpm, pnpm, yarn or bun
Visual Studio CodeA free editor with excellent JavaScript and TypeScript supportLatest

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.

  1. Step 1: Install a version manager

    fnm is fast and works on macOS, Linux and Windows. On Windows, install it with winget install Schniz.fnm instead of the script below.

    Terminal
    curl -fsSL https://fnm.vercel.app/install | bash
  2. Step 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-latest
  3. Step 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 dev

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

.vscode/settings.json
{
  "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.

check.mjs
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.')
Terminal
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.