Explain Cannot find module errors

Paste a Node.js "Cannot find module" error, and Vibe explains it in plain English: which file Node.js looked for, which file asked for it and whether the fix is a file name or a package install.

module-not-found.txt

Up to 1,500 characters (about 60 lines). Your code is sent to Unvibe and Anthropic to write the explanation. Don't paste keys or passwords. Common key formats are refused.

Vibe22 lines selected

Press Explain it for the sample, or paste your own code first.

What this Cannot find module sample shows

the 2 paths
Cannot find module '/home/dev/blog/lib/slugify' imported from /home/dev/blog/build.js names 2 files: the one Node.js looked for, and the one that asked for it. Line 2 of build.js, import { slugify } from './lib/slugify';, became the first path by starting from build.js's folder. Nothing printed before the error: Node.js finds every import before it runs any line of the file. The run ended with exit code 1.
the file extension
lib/slugify.js was there. In an ES module an import has to name the whole file, and Node.js doesn't add .js for you; the next line says so: Did you mean to import "./lib/slugify.js"?. With .js added, build.js printed hello-world.html and what-i-learned-shipping-my-first-app.html. In a CommonJS copy of the script, require('./lib/slugify') worked without the .js.
module or package
A path that starts with ./ or ../ is a file in your project. A bare name is a package: import matter from 'gray-matter'; with gray-matter not installed failed with Cannot find package 'gray-matter' imported from /home/dev/blog/build.js, and after npm install gray-matter the build ran. In an import, the word after Cannot find tells you which of the 2 you have. require says Cannot find module for both: require('gray-matter') printed Error: Cannot find module 'gray-matter', so there the ./ decides.
the stack
All 10 at lines point into node:internal, the part of Node.js that loads files, and so does the first line, node:internal/modules/run_main:107. None is a line of yours; the imported from path is where to look. The Did you mean hint only shows when a file with the added ending exists: with a typo, ./lib/slugfy.js, the error named the path and gave no hint.

Good to know

  • Run with Node.js 25.7.0 and npm 11.10.1 on Linux in a test folder mounted at /home/dev/blog, which is why the paths start with /home/dev/blog.
  • With require in a CommonJS file, the same kind of mistake reads differently: Error: Cannot find module './lib/slugfy', then Require stack: and the file that asked, and code: 'MODULE_NOT_FOUND' instead of ERR_MODULE_NOT_FOUND.

Before you trust it: npm install doesn't create your own files: after it printed up to date, node build.js failed the same way. The old --experimental-specifier-resolution=node flag didn't help either; Node.js 25.7.0 ran with it and printed the same error. When an AI tool suggests either for a ./ path, check the file name in the import first.

Explain Cannot find module errors beside your editor

Unvibe is a free app for Mac and Windows. In the app there is no pasting: select code in any app and press Control+U (Ctrl+Alt+U on Windows).

Install on Mac

curl -fsSL https://unvibe.site/install.sh | bash

Paste into Terminal. Unvibe isn't notarized by Apple yet, so this is the smooth path.

No install warning? Use Unvibe in your browser

Opening the .dmg the first time

Unvibe isn't notarized by Apple yet, so macOS blocks the first open until you allow it. Its code is public on GitHub.

  1. Open the .dmg, drag Unvibe to Applications and open it. macOS says it can't verify it. Click Done, not the blue Move to Trash.
    macOS dialog: “Unvibe” Not Opened, with a blue Move to Trash button on top and Done under it
    Real screen, macOS 26. On macOS 15 the two buttons sit side by side.
  2. System Settings › Privacy & Security, scroll down to Security, then press Open Anyway. Confirm, then enter your Mac password. The button shows for about an hour after you try to open Unvibe.
    macOS Privacy & Security, Security section: Unvibe was blocked to protect your Mac, with the Open Anyway button
    Real screen, macOS 15
  3. Unvibe opens. You only do this once, and later versions install from inside the app with one click.
    Unvibe's first window: Vibe says Hey! I'm Vibe. I explain the code AI writes for you, right beside your editor, over the title Understand the code AI writes
    Real screen, Unvibe 0.1.51 on macOS 26

The Terminal line checks the download against the published SHA-256 and Unvibe's self-signed signature before it installs anything. More help with the first open