question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Expo] [MapLibre] module 'Mapbox' not found

See original GitHub issue

Describe 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

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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mlecoqcommented, Aug 3, 2021

Ok, I understand

Expo plugin does not add

  post_install do |installer|
    $RNMBGL.post_install(installer)
    ... other post install hooks
  end

in podfile

Adding this solves the issue, I will see if I can update expo plugin

1reaction
EvanBaconcommented, Aug 2, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found