/cursor-tutorials

Why Cursor suggests missing packages

Learn why Cursor suggests missing packages and how to fix common dependency issues for smoother, faster coding.

Matt Graham, CEO of Rapid Developers

Book a call with an Expert

Starting a new venture? Need to upgrade your web app? RapidDev builds application with your growth in mind.

Book a free No-Code consultation

Why Cursor suggests missing packages

Cursor suggests missing packages because it analyzes the code you’re writing (or editing) and compares it against what actually exists in your local project. If it sees that you’re importing or calling something that isn’t installed in your project’s dependencies, it flags it. Sometimes it’s correct — sometimes it’s just guessing based on patterns in the code. Cursor does not magically know your environment; it infers based on file contents, lockfiles, and the local runtime feedback (like Node or Python errors). So when Cursor suggests installing a package, it’s usually because you referenced something that appears to come from an external library, but the library isn’t listed in your package.json, requirements.txt, or your environment generally.

 

Why Cursor Does This

 

Cursor behaves a bit like a teammate who’s watching your code and saying “hey, looks like you meant to use this library — but it’s not installed.” It does this by scanning your files and looking for things that normal projects usually depend on.

  • It sees an import that isn’t installed. For example, you write import express from 'express' but your package.json doesn’t list express. Cursor will suggest adding it.
  • It sees a pattern associated with a common library. If you write a function that looks like it’s meant to use a well‑known package (like using bcrypt-style functions), Cursor might guess you need that package.
  • It reads your error messages. If your terminal inside Cursor shows something like “Module not found: express,” Cursor uses that feedback and suggests installing it.
  • It notices missing type definitions in TypeScript projects. If you have TypeScript and import a package without types, it may suggest @types/yourpackage.

Cursor doesn’t actually check your environment by running a deep scan or installing anything — it only uses what’s visible in your files and your local errors. Because of that, it can be helpful but also occasionally get things wrong.

 

Real Examples

 

Here’s how this looks in a real project:

// app.js
import express from 'express'  // Cursor sees this import

const app = express()
app.get('/', (req, res) => res.send('Hello'))
app.listen(3000)

If your package.json has no "express" entry, Cursor will suggest installing it:

npm install express

This suggestion is correct, because Node won't actually run without it.

 

Why Cursor Sometimes Suggests Wrong Packages

 

This happens because Cursor uses pattern-based reasoning, not a full understanding of your runtime. A few common reasons:

  • Your code resembles a known library’s API, even if you’re writing something custom.
  • You renamed a file or changed imports, and the context window still contains old references.
  • You have leftover type hints or comments that mention a library.
  • Your environment actually has the package installed, but your project file (like package.json or requirements.txt) doesn't list it — Cursor trusts the file more than the environment.

 

How to Know if Cursor's Suggestion Is Actually Correct

 

You can verify it yourself quickly:

  • Check whether the import is local or external. If it's local, it should start with ./ or ../.
  • Check your package.json or requirements.txt to see if the dependency truly exists.
  • Try running your program — if it breaks with ModuleNotFoundError or Cannot find module, you know it's real.
  • If it’s TypeScript, check whether the missing thing is just type definitions.

 

Practical Advice When Using Cursor

 

  • Don’t install everything Cursor suggests blindly. Verify first.
  • If Cursor keeps suggesting a wrong package, rewrite the import so it clearly points to your local file, like import utils from './utils'.
  • Keep your dependency files clean. Cursor works better when package.json and requirements.txt are up to date.
  • Use the integrated terminal to confirm. For example: npm list express or pip show requests.

 

That’s why Cursor suggests missing packages: it’s trying to be helpful by inferring what your code needs, but it relies entirely on what it sees in the files and the errors in your local environment.

Still stuck?
Copy this prompt into ChatGPT and get a clear, personalized explanation.

This prompt helps an AI assistant understand your setup and guide you through the fix step by step, without assuming technical knowledge.

AI AI Prompt

Want to explore opportunities to work with us?

Connect with our team to unlock the full potential of no-code solutions with a no-commitment consultation!

Book a Free Consultation

Client trust and success are our top priorities

When it comes to serving you, we sweat the little things. That’s why our work makes a big impact.

Rapid Dev was an exceptional project management organization and the best development collaborators I've had the pleasure of working with. They do complex work on extremely fast timelines and effectively manage the testing and pre-launch process to deliver the best possible product. I'm extremely impressed with their execution ability.

CPO, Praction - Arkady Sokolov

May 2, 2023

Working with Matt was comparable to having another co-founder on the team, but without the commitment or cost. He has a strategic mindset and willing to change the scope of the project in real time based on the needs of the client. A true strategic thought partner!

Co-Founder, Arc - Donald Muir

Dec 27, 2022

Rapid Dev are 10/10, excellent communicators - the best I've ever encountered in the tech dev space. They always go the extra mile, they genuinely care, they respond quickly, they're flexible, adaptable and their enthusiasm is amazing.

Co-CEO, Grantify - Mat Westergreen-Thorne

Oct 15, 2022

Rapid Dev is an excellent developer for no-code and low-code solutions.
We’ve had great success since launching the platform in November 2023. In a few months, we’ve gained over 1,000 new active users. We’ve also secured several dozen bookings on the platform and seen about 70% new user month-over-month growth since the launch.

Co-Founder, Church Real Estate Marketplace - Emmanuel Brown

May 1, 2024 

Matt’s dedication to executing our vision and his commitment to the project deadline were impressive. 
This was such a specific project, and Matt really delivered. We worked with a really fast turnaround, and he always delivered. The site was a perfect prop for us!

Production Manager, Media Production Company - Samantha Fekete

Sep 23, 2022