Skip to content

Nextjs Import Error #487

@Overdash

Description

@Overdash

I'm having trouble using the SDK in Next.js

I'm trying to (only) use the Geocoding service to retrieve Coordinates:

import geocodingClient from "@mapbox/mapbox-sdk/services/geocoding-v6"

But I get this error when Next.js tries to build my project with @mapbox/mapbox-sdk imported

Module not found
  20 | 	if (options.adapter || options.uri) {
  21 | 		const adapter = options.adapter || /^[^:+]*/.exec(options.uri)[0];
> 22 | 		return new (require(adapters[adapter]))(options);
     | 		            ^^^^^^^^^^^^^^^^^^^^^^^^^^
  23 | 	}
  24 |
  25 | 	return new Map();

https://nextjs.org/docs/messages/module-not-found


    at <unknown> (Error: ./node_modules/keyv/src/index.js:22:14)
    at <unknown> (https://nextjs.org/docs/messages/module-not-found)

image

Seems to be coming from keyv in cacheable-request that's used by got package. I tried to override the package to the latest version, but no dice.

"overrides": {
    "@mapbox/mapbox-sdk": {
      "got": {
        "cacheable-request": "12.0.1"
      }
    }
  }

Anyone experienced this before?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions