[Expo] [MapLibre] module 'Mapbox' not found
See original GitHub issueDescribe the bug
I have an expo app and I would like to use MapLibre instead of MapBox
I have the following error:
› Compiling @react-native-mapbox-gl/maps Pods/react-native-mapbox-gl » FilterParser.m
❌ (node_modules/@react-native-mapbox-gl/maps/ios/RCTMGL/FilterParser.m:10:9)
8 |
9 | #import "FilterParser.h"
> 10 | #import <Mapbox/Mapbox.h>
| ^ 'Mapbox/Mapbox.h' file not found
To Reproduce
- Create a new Expo app
- Add a scheme in
app.json
- Install react-native-mapbox following (https://github.com/react-native-mapbox-gl/maps/blob/master/plugin/install.md)
- Update podfile to add
$RNMBGL_Use_SPM = true
pod update
in ios directory- expo run:ios
During pod update I see
Removing Mapbox-iOS-SDK
Removing MapboxMobileEvents
but no reference to MapLibre
On android I have a similar issue:
› Compiling @react-native-mapbox-gl/maps Pods/react-native-mapbox-gl » MGLSnapshotModule.m
❌ (node_modules/@react-native-mapbox-gl/maps/ios/RCTMGL/RCTMGLUtils.h:14:9)
12 | #import <React/RCTImageLoader.h>
13 |
> 14 | @import Mapbox;
| ^ module 'Mapbox' not found
Here is an app example : https://github.com/mlecoq/expo-maplibre
Expected behavior
I can run MapLibre with Expo
Actual behavior
MapBox is ok but MapLibre crashes
Versions (please complete the following information):
- Platform: Android and iOS
- Platform OS: Android 11, iOS 14.4
- Device: iPhone 12
- Emulator/ Simulator: yes
- Dev OS: osx
- react-native-mapbox-gl Version 8.2.1
- React Native Version 0.63
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:11 (3 by maintainers)
Top Results From Across the Web
(Ios) Error Module 'Mapbox' not found · Issue #1402 - GitHub
A not ideal solution that I found for it: call mapbox's script to download the framework manually before the ios build ( npm...
Read more >Cannot find module 'mapbox-gl/dist/mapbox-gl.js'
I was able to get around this issue by using this import instead: import * as mapboxgl from 'mapbox-gl';. But not all is...
Read more >module not found: error: can't resolve 'mapbox-gl ... - You.com
For anyone like me who just wanted to get a map to show in their project, here's how I got it. Based mostly...
Read more >Mapbox GL | Voters - Expo
Hey folks, we @ TheOutbound.com were interested in using Mapbox GL in Expo, so with the EAS announcement, we built an example project...
Read more >Use Mapbox GL JS in a React app | Help
Working familiarity with React. ... Initializing your map here ensures that Mapbox GL JS will not try to render a map before React...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, I understand
Expo plugin does not add
in podfile
Adding this solves the issue, I will see if I can update expo plugin
I didn’t add support for MapLibre, it would require a PR to add support, or just setting the package up manually and not using prebuild.
In general, this plugin is “very dangerous” because it uses regexes in an application file. We’re working on a system for library authors to define postinstall / preinstall blocks for their native module as part of Expo autolinking. When that is released we can rewrite this plugin to support more features and be safer.