Skip to content
VibecodeZero

'npm' is not recognized or command not found: npm when you run your AI-built app

Updated

On this page (4)
  1. Symptom
  2. Cause
  3. Prompt to paste
  4. How not to burn credits

Symptom

You try to run your app on your computer and the terminal says 'npm' is not recognized as an internal or external command, operable program or batch file (Windows Command Prompt), The term 'npm' is not recognized as the name of a cmdlet (PowerShell), zsh: command not found: npm (Mac) or bash: npm: command not found (Linux). The same can happen with node or npx.

Cause

When you run a project on your own computer, you type commands like npm install and npm run dev in a terminal. npm is the program that downloads your app’s packages and starts it. It isn’t part of Windows or macOS. It comes with Node.js, so until Node.js is installed, the terminal has no idea what npm means.

You run into this the first time you leave the browser: a project from Cursor or Claude Code, or a Bolt, Lovable or v0 project you downloaded or pulled from GitHub. In the browser, those tools run the app for you, so you never needed npm before.

Common causes

  • Node.js isn’t installed. By far the most common. Installing it adds node, npm and npx at once.
  • The terminal was already open. A terminal reads the list of installed programs when it opens. If you installed Node.js afterwards, that terminal still can’t see it.
  • The editor was already open. The terminal inside Cursor or VS Code inherits that list from the editor, so the editor needs a restart, not just a new terminal tab.
  • Node.js was installed with a version manager, like nvm, and the current terminal hasn’t loaded it.
  • On Windows, the installer’s PATH option was turned off. The installer adds Node.js to the system PATH by default. If that option was unchecked, running the installer again with it on fixes it.

Beginner steps

  1. Check first. Run node -v. If it shows a version number, Node.js is installed and you can skip to step 4.
  2. Install Node.js. Go to nodejs.org and download the LTS version, the one meant for most people. Run the installer and keep the default options. On a Mac, if you already use Homebrew, brew install node works too.
  3. Close and reopen everything. Close all terminals. If you use Cursor, VS Code or another editor, quit it completely and open it again.
  4. Check again. Run node -v and npm -v. Both should show a version number.
  5. Go to the project folder. It’s the folder with package.json in it. In the editor’s terminal, it’s usually already there. In a separate terminal, use cd followed by the folder path.
  6. Install and start. Run npm install, wait for it to finish, then npm run dev. Open the address it prints, like http://localhost:3000.

On Windows PowerShell

If PowerShell says npm.ps1 cannot be loaded because running scripts is disabled on this system, npm is installed. PowerShell is just blocking the small script that starts it. The simplest way around it is to use Command Prompt instead, or to type npm.cmd instead of npm. To allow it for your user account, you can run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once. That lets scripts made on your computer run, while scripts downloaded from the internet still need a signature.

If you used nvm

On Mac and Linux, nvm loads Node.js when a terminal starts. If a new terminal can’t find npm, run nvm use --lts. To make that version the default for every new terminal, run nvm alias default lts/*.

Once npm works, the next errors you might see are ERESOLVE unable to resolve dependency tree during npm install, Cannot find module when the app starts, or Port 3000 is already in use if another copy is still running.

Prompt to paste

Copy the text below, replace what’s in brackets and send it in the chat of the tool you’re using.

Paste into the AI
I'm trying to run my app on my computer and the terminal says:
[paste the whole message]

My computer is: [Windows / Mac / Linux].
I'm using the terminal in: [Command Prompt / PowerShell / Terminal app / the terminal inside Cursor, VS Code or another editor].
When I run node -v, I get: [paste what it shows].

Don't change any code in my app. This is about setting up my computer.
Explain, step by step and in plain words, how to install Node.js (which includes npm) from the official site nodejs.org, and how to check that it worked.
Then tell me the exact commands to run in my project folder to install the packages and start the app.

How not to burn credits

  • Before you ask the AI, run node -v. If it also isn't found, Node.js isn't installed, and installing it from nodejs.org fixes this without a single message.
  • Installed it already? Close the terminal and the editor completely and open them again before trying anything else. Most cases that remain are just an old terminal.
  • This isn't a bug in your code. If the AI starts editing files to fix it, stop it and say: don't change code, only help me install Node.js.

How Lovable counts credits, and what the free plan includes: Lovable credits explained.

Questions people ask

What does 'npm' is not recognized mean?

Your terminal looked for a program called npm and didn't find it. On Windows the message is 'npm' is not recognized as an internal or external command, and on Mac or Linux it's command not found: npm. It almost always means Node.js, which includes npm, isn't installed, or the terminal was opened before it was installed.

Do I install npm separately from Node.js?

No. The Node.js installer from nodejs.org includes npm and npx. Install Node.js and you get all three. The LTS version is the one meant for most people.

I installed Node.js and it still says npm is not found. Why?

Usually the terminal, or the editor it lives in, was open before the install. It still has the old list of programs. Close every terminal, quit Cursor or VS Code completely, open them again and run npm -v. On Windows, if it still fails, run the installer again and keep the option that adds Node.js to PATH turned on.

PowerShell says running scripts is disabled. Is npm broken?

No. npm is installed, but PowerShell is blocking the small script that starts it. Use Command Prompt, or type npm.cmd instead of npm. To allow it for your user account, run Set-ExecutionPolicy -Scope CurrentUser RemoteSigned once in PowerShell.

Do I need npm to use Lovable, Bolt or v0?

Not in the browser. Those tools install and run the packages for you. You need Node.js and npm only when you run the project on your own computer, for example after downloading it or opening it in Cursor or Claude Code.

npm works now, but it says Could not read package.json. What's wrong?

npm is running in the wrong folder. It needs the folder that has the package.json file, usually the project's main folder. Open the terminal there, or move into it with cd followed by the folder path, and run the command again.

New guides by email. An email when we publish a new guide, error fix or chapter, in plain English. Subscribe