Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't resolve 'react-map-gl' #11268

Closed
younitee opened this issue Nov 10, 2021 · 4 comments
Closed

Can't resolve 'react-map-gl' #11268

younitee opened this issue Nov 10, 2021 · 4 comments

Comments

@younitee
Copy link

mapbox-gl-js version: 5.1.1

Question

I am attempting to build a create react app with typescript and mapbox-gl-js and get the following response:

"Module not found: Can't resolve 'react-map-gl' in ..."

Notable dependencies:
"@types/react-map-gl": "^6.1.1", "react": "^17.0.2", "react-mapbox-gl": "^5.1.1", "typescript": "^4.1.2",

Tried many things... am I missing something obvious?

Links to related documentation

#10565

@ryanhamley
Copy link
Contributor

Hi @younitee I believe what you want is

import ReactMapboxGl, { Layer, Feature } from 'react-mapbox-gl';
import 'mapbox-gl/dist/mapbox-gl.css';

Based on the error message you supplied, you're requesting react-map-gl instead of react-mapbox-gl. Hope that helps.

By the way, I noticed in trying to reproduce this that there's some peer dependency issues when installing react-mapbox-gl. We don't maintain that library so if you run into further issues, you should open issues on their Github repo.

@younitee
Copy link
Author

oh shweet, I mix-and-matched my libraries... so embarrassed! thanks for catching that @ryanhamley

@Kiiitttttuuu
Copy link

ERROR in ./node_modules/react-map-gl/dist/esm/exports-mapbox.js 16:15-34
Module not found: Error: Can't resolve 'mapbox-gl' in 'C:\Users\Asus\New folder\ip-finder\node_modules\react-map-gl\dist\esm'

@Kiiitttttuuu
Copy link

ERROR in ./node_modules/react-map-gl/dist/esm/exports-mapbox.js 16:15-34
Module not found: Error: Can't resolve 'mapbox-gl' in 'C:\Users\Asus\New folder\ip-finder\node_modules\react-map-gl\dist\esm'

please anybody understand this error then please give me ans how can do correct the problems

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants