Next.js Discord

Discord Forum

Type error: Cannot find module 'limiter' or its corresponding type declarations.

Unanswered
Cuban Crocodile posted this in #help-forum
Open in Discord
Cuban CrocodileOP
Hello, I am encountering the following error even for a TypeScript (.ts) file that is not being imported or used anywhere. Note that I don't have the 'limiter' package installed because it's not needed currently. I want to keep the file because it is a work in progress, but can't figure out why it is causing npm run build to fail. Any ideas?

next build

  ▲ Next.js 14.2.4
  - Environments: .env.local

   Creating an optimized production build ...
 ✓ Compiled successfully
   Linting and checking validity of types  ..Failed to compile.

./utils/getIPGeoLocation.ts:3:29
Type error: Cannot find module 'limiter' or its corresponding type declarations.

  1 | // This is currently not working as intended. I need to cache the result of the API lookup, but can't get NextJS caching to work right now. Without it, we will very easily hit the API limit
  2 |
> 3 | import { RateLimiter } from "limiter";
    |                             ^
  4 |
  5 | const limiter = new RateLimiter({
  6 |     tokensPerInterval: 45,

0 Replies