Node.js gives you everything you need to build, run, and orchestrate local AI agents. In this step, you’ll install Node, verify your setup, and create your first project folder.
Now that you’ve explored how different models perform on your machine, it’s time to set up the environment where your agent will actually live. Node.js is the foundation of your local‑first AI development workflow. It lets you write JavaScript that talks to your local models, interacts with tools, reads and writes files, and eventually orchestrates full autonomous loops.
Node is fast, lightweight, and supported everywhere. It’s also the ecosystem behind millions of applications — meaning your agent can integrate with almost anything. Installing it now prepares your system for the next step: building your first real AI agent.
On macOS, the easiest way to install Node.js is through Homebrew. This gives you automatic updates and a clean, system‑managed installation.
Or download the official installer from the Node.js website:
https://nodejs.org/en/download
Windows users should install Node.js using the official MSI installer. Choose the LTS (Long‑Term Support) version for maximum stability.
https://nodejs.org/en/download
After installation, restart PowerShell or your terminal so the node and npm commands become available.
Most Linux distributions include Node.js in their package managers, but versions can vary. For a quick install:
For newer versions, use the official NodeSource repository:
Advanced users may prefer nvm (Node Version Manager), which lets you switch between Node versions easily.
Check your Node.js version:
Check npm (Node’s package manager):
If both commands return version numbers, your environment is ready for agent development.
Your agent needs a home — a folder where its code, tools, and configuration will live. Create one anywhere you like:
Initialize a new Node project:
This generates a package.json file, which tracks your dependencies and scripts. It’s the heart of every Node project.
To connect your JavaScript agent to your local models, install the official Ollama JavaScript client:
This library lets your agent send prompts, stream responses, and interact with any model you’ve installed.
“node: command not found”
npm errors
npm cache clean --forcenode_modules and reinstallPermission issues (Linux)
sudo for system installs
Next Step
Build Your First Agent →