Node.js Not Found When Running AI Coding Agents
Node.js is either missing, installed in the wrong place, or installed correctly but not on the `PATH` your AI coding agent actually uses. The fastest safe fix is to check `node -v` in the same shell or IDE session that launches the agent, then restart the terminal or editor so it picks up any path changes. If that still fails, you’re usually looking at a shell mismatch or a Node version mismatch, not a broken agent.
What the error is really saying
The message is usually not about your AI agent itself. It means the agent tried to run node and could not find it, or it found a different node than the one you expected.
The exact message variesSometimes the symptom is a plain “node not found” failure. Other times the agent starts, but then errors because the Node version is too old or too new for that tool. A third common case is that node works in one terminal window, but the agent is launched from a different process with a different PATH.
If you can run node -v in one shell but the agent still fails, treat this as an environment mismatch first, not a broken agent.
When this fix applies
This applies to local AI coding agents and CLI tools such as Cursor, Claude Code, Codex-style CLIs, and IDE-integrated agents that spawn their own terminal process. It also applies when the agent is launched from VS Code, JetBrains IDEs, a built-in terminal, or a shell panel inside another editor.
It does not cover remote servers where Node is intentionally absent, container images that were built without Node, or agents that bundle their own runtime and are failing for a different reason. If the tool has its own installer or runtime manager, check its setup notes too.
Before you change anything, do two safe checks:
- Run
node -vin the same terminal you use to start the agent. - Run
which nodeon macOS or Linux, orwhere nodeon Windows, to see which executable is being used.
If those commands fail, Node is missing or not on PATH. If they work in one place but not inside the agent, you’re dealing with a shell or editor environment difference.
This usually does not require Administrator rights or sudo. You may need a restart of the terminal, IDE, or agent process after fixing PATH or reinstalling Node.
The quickest safe fix
Start by confirming that Node is installed and visible in your current shell. Then restart the terminal, the editor, or both, because many apps only read PATH when they start.
- Check Node in the shell you are using.
node -v
npm -vIf you get version numbers, Node is installed in that shell. If you get “command not found” or a similar error, continue with the platform-specific fix below.
- Restart the shell or editor that launches the agent.
This matters because a path change made earlier in the day may not reach already-open terminals, IDEs, or agent processes. If the agent still cannot see Node after a restart, the problem is usually a different shell, a missing path entry, or a version mismatch.
If Node is installed but the agent still says not found
This is the common case where your terminal can run Node, but the agent cannot. The agent is usually started by a different process, so it inherits a different environment, especially a different PATH.
A few common causes:
- You installed Node with
nvm, but the agent is started from an IDE that was opened beforenvminitialized. - You fixed
PATHin one terminal profile, but the agent uses a login shell or non-login shell with different startup files. - You can run Node from a regular terminal, but the agent is launched from VS Code’s integrated terminal or a task runner that does not load the same profile.
The fix is usually to start the agent from the same terminal where node -v works, or to fully restart the IDE so it inherits the updated environment. If the tool has a setting for the shell path, make sure it points to the shell that loads your Node setup. If you use a version manager, check that its initialization lines are in the right startup file for the shell the agent actually uses.
Windows users: check the PATH and reinstall if needed
On Windows, the safest first check is whether node.exe is visible from Command Prompt or PowerShell, and whether Windows can find it on PATH.
- Open a new Command Prompt.
- Check Node and its location.
node -v
where nodeIf node -v prints a version and where node shows a path under C:\Program Files\nodejs\, Windows can see Node.
- If
nodeis missing, open the system environment variables and confirmC:\Program Files\nodejs\is onPATH. - If the path is broken or missing, reinstall Node using the official Windows installer and keep the default options.
A repair install is usually the fastest safe fix if node.exe exists but Windows still cannot find it. After reinstalling, close all terminals and IDEs, then open a fresh one. If the agent still fails, it is probably starting from an older environment or a different shell than the one you just tested.
macOS and Linux users: fix shell path issues
On macOS and Linux, Node is often installed through Homebrew, nvm, or asdf, and each of those can work in one shell while disappearing in another.
- Check where Node is coming from.
node -v
which nodeIf which node returns a path like /opt/homebrew/bin/node, /usr/local/bin/node, or a version-manager path, Node is installed.
- If
nodeworks in Terminal but not in the IDE, restart the IDE fully. - If you use
nvm,asdf, or similar, make sure its startup code is in the file your shell actually reads. For example, a login shell may use one startup file while an interactive non-login shell uses another. - If Node was installed with Homebrew, make sure the Homebrew bin directory is on
PATHin the shell that launches the agent.
On macOS, this often comes down to the IDE inheriting an older launch environment. On Linux, it is often a shell startup file issue. In both cases, a full app restart after fixing the shell config is usually necessary.
If your agent needs a different Node version
Some agents work only with certain Node versions, even when Node is installed correctly. In that case the error can look like “not found,” even though the real problem is that the version the agent sees is unsupported or too old.
A simple example with nvm looks like this:
- Check the current version.
node -v- Switch to a supported LTS version.
nvm install --lts
nvm use --lts- Confirm the shell now uses that version.
node -vIf the agent still does not follow the version you selected, it is probably not using the same shell session. Open the agent from the same terminal where nvm use worked, or restart the editor so it picks up the active version. If the tool documents a specific Node major version, use that instead of assuming the latest release will work.
How to verify the fix worked
Verify in the same place the agent will run, not just in a random terminal that happens to work.
- Open the terminal, shell panel, or IDE session you will use for the agent.
- Run the version checks.
node -v
npm -v
which node- Start the agent from that same session or restart the editor and run the agent again.
Expected result: node -v prints a version, npm -v prints a version, and which node or where node shows the path you expect. If the agent now starts, the fix is done.
If the terminal checks pass but the agent still fails, the agent is probably spawned by a different shell profile, a stale IDE session, or a wrapper process with its own environment.
How to stop this from happening again
Pick one Node installation method and stick with it. Mixing the system installer, Homebrew, nvm, and asdf is the quickest way to end up with different shells seeing different Node versions.
A few practical habits help:
- Restart your editor after installing or upgrading Node.
- Keep version-manager setup in the correct shell startup file.
- Avoid multiple copies of Node on
PATHunless you know which one should win. - If you use an IDE-integrated agent, launch the IDE from a terminal after activating the Node version you want.
If you change Node versions often, version managers are fine. Just be consistent about which one owns the version your agent should see.
Common questions when Node still won’t show up
If npm works but node does not, that usually means you are not actually calling the same install you think you are. Check which node or where node to see the real path.
If the VS Code terminal sees Node but the agent does not, restart VS Code completely. The integrated terminal can pick up a newer shell environment than the agent process, especially after a PATH or version-manager change.
If you are using WSL, remember that Windows and WSL are separate environments. Installing Node in Windows does not make it available inside WSL, and the reverse is also true.
If the vendor bundles its own runtime, a missing Node error may mean the bundle is broken or the tool is looking for Node only for a plugin, extension, or script. In that case, check the tool’s own setup notes before you keep changing your global Node install.
Conclusion
Once Node is visible in the same shell and app session that launches the agent, the error usually disappears. If it does not, check the exact `PATH`, shell type, and Node version the agent inherits, then restart the editor or relaunch the agent from a clean terminal.
Frequently Asked Questions
Why does Node work in my terminal but not in my AI agent?
The agent is probably launched from a different process, shell, or IDE session, so it inherits a different `PATH`. Restart the editor or start the agent from the same terminal where `node -v` works.
Should I reinstall Node right away?
Not usually. First check whether `node -v` works and whether the agent is using a different shell. Reinstall only if Node is missing, broken, or installed in the wrong place.
Do I need administrator rights or sudo?
Only if you are repairing a system-level install or changing protected environment settings. If you use `nvm` or another user-level version manager, you often do not need elevated privileges.
Can an agent fail because of the wrong Node version even when Node is installed?
Yes. Some tools require a specific Node major version or an LTS release. If the version is wrong, switch to the supported version and restart the shell or IDE.