react-native-background-geolocation: Error in fresh new project with Expo in IOS

Your Environment

  • Plugin version: “react-native-background-fetch”: “^4.1.5”, “react-native-background-geolocation”: “^4.9.3”,
  • Platform: iOS
  • OS version: macOs Monterey
  • Device manufacturer / model: MacBook air (M1,2020) 16gb
  • React Native version (react-native -v): react-native-cli: 2.0.1 react-native: 0.70.5
  • Plugin config
{
  "expo": {
    "name": "Zerel-Parksharing",
    "slug": "Zerel-Parksharing",
    "version": "1.0.0",
    "assetBundlePatterns": [
      "**/*"
    ],
    "plugins": [
      [
        "react-native-background-geolocation",
        {
          "license": ""
        }
      ],
      [
        "expo-gradle-ext-vars",
        {
          "googlePlayServicesLocationVersion": "20.0.0",
          "appCompatVersion": "1.4.2"
        }
      ],
      "react-native-background-fetch"
    ],
    "ios": {
      "infoPlist": {
        "NSLocationAlwaysAndWhenInUseUsageDescription": "[Zerel Parksharing] This app requires location in the background",
        "NSLocationWhenInUseUsageDescription": "[Zerel Parksharing] This app requires location while in use",
        "NSMotionUsageDescription": "[Zerel Parksharing] This app uses motion-detection to determine the motion-activity of the device (walking, vehicle, bicycle, etc)",
        "UIBackgroundModes": [
          "location",
          "fetch",
          "processing",
          "audio"
        ],
        "BGTaskSchedulerPermittedIdentifiers": [
          "com.transistorsoft.fetch",
          "com.transistorsoft.customtask"
        ]
      },
      "bundleIdentifier": "com.zerelparksharing"
    },
    "android": {
      "package": "com.zerelparksharing"
    }
  },
  "name": "Zerel-Parksharing"
}

Expected Behavior

Should run the project on IOS without any errors.

PS: By the way, we do have another app(yes we’ve 5 license keys) with this lib and works well but the version of the react-native and the plugin is different and we don’t use expo

Actual Behavior

I´ve followed this tutorial below and I´ve inserted my license key on the app.json The app run on Android as you can see below image

However in ios the app doesn´t work: image

Steps to Reproduce

  1. Create a new project bare workflow with expo
  2. follow the tutorial on this link: https://github.com/transistorsoft/react-native-background-geolocation/blob/master/help/INSTALL-EXPO.md
  3. expo start
  4. press a to open the android version (works) and press I to open the IOS version(got an error)

My package.json:

{
  "name": "zerel-parksharing",
  "version": "1.0.0",
  "main": "index.js",
  "scripts": {
    "start": "expo start --dev-client",
    "android": "expo run:android",
    "ios": "expo run:ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@expo/vector-icons": "^13.0.0",
    "@hookform/resolvers": "^2.9.10",
    "@react-native-masked-view/masked-view": "0.2.8",
    "@react-navigation/native": "^6.0.13",
    "@react-navigation/native-stack": "^6.9.1",
    "@react-navigation/stack": "^6.3.4",
    "@reduxjs/toolkit": "^1.9.0",
    "expo": "~47.0.6",
    "expo-gradle-ext-vars": "^0.1.1",
    "expo-splash-screen": "~0.17.5",
    "expo-status-bar": "~1.4.2",
    "native-base": "^3.4.22",
    "react": "18.1.0",
    "react-hook-form": "^7.39.4",
    "react-native": "0.70.5",
    "react-native-background-fetch": "^4.1.5",
    "react-native-background-geolocation": "^4.9.3",
    "react-native-gesture-handler": "~2.8.0",
    "react-native-safe-area-context": "4.4.1",
    "react-native-screens": "~3.18.0",
    "react-native-svg": "13.4.0",
    "react-redux": "^8.0.5",
    "styled-components": "^5.3.6",
    "yup": "^0.32.11"
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@types/react": "17.0.43",
    "@types/react-native": "~0.70.6",
    "@types/styled-components-react-native": "^5.2.0",
    "@typescript-eslint/eslint-plugin": "^5.43.0",
    "@typescript-eslint/parser": "^5.43.0",
    "babel-plugin-module-resolver": "^4.1.0",
    "babel-plugin-root-import": "^6.6.0",
    "eslint": "^8.27.0",
    "eslint-config-airbnb": "^19.0.4",
    "eslint-config-prettier": "^8.5.0",
    "eslint-import-resolver-typescript": "^3.5.2",
    "eslint-plugin-import": "^2.25.3",
    "eslint-plugin-import-helpers": "^1.3.1",
    "eslint-plugin-jsx-a11y": "^6.5.1",
    "eslint-plugin-prettier": "^4.2.1",
    "eslint-plugin-react": "^7.28.0",
    "eslint-plugin-react-hooks": "^4.3.0",
    "prettier": "^2.7.1",
    "typescript": "^4.6.3"
  },
  "private": true,
  "resolutions": {
    "styled-components": "^5",
    "@types/react": "~17.0.43"
  }
}

Debug logs

Logs
 Opening on iOS...
› Opening exp://127.0.0.1:19000 on iPhone 13
› Press ? │ show all commands
iOS Bundling complete 2241ms

Invariant Violation: Your JavaScript code tried to access a native module that doesn't exist. 

If you're trying to use a module that is not supported in Expo Go, you need to create a development build of your app. See https://docs.expo.dev/development/introduction/ for more info.
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:95:17 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:141:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:39 in handleError
at node_modules/expo/build/errors/ExpoErrorManager.js:25:19 in errorHandler
at node_modules/expo/build/errors/ExpoErrorManager.js:30:24 in <anonymous>
at node_modules/@react-native/polyfills/error-guard.js:49:36 in ErrorUtils.reportFatalError
at node_modules/metro-runtime/src/polyfills/require.js:237:40 in guardedLoadModule
at http://127.0.0.1:19000/index.bundle?platform=ios&dev=true&hot=false&minify=false:null in global code

Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:95:17 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:141:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:39 in handleError
at node_modules/expo/build/errors/ExpoErrorManager.js:25:19 in errorHandler
at node_modules/expo/build/errors/ExpoErrorManager.js:30:24 in <anonymous>
at node_modules/@react-native/polyfills/error-guard.js:49:36 in ErrorUtils.reportFatalError

Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:95:17 in reportException
at node_modules/react-native/Libraries/Core/ExceptionsManager.js:141:19 in handleException
at node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:39 in handleError
at node_modules/expo/build/errors/ExpoErrorManager.js:25:19 in errorHandler
at node_modules/expo/build/errors/ExpoErrorManager.js:30:24 in <anonymous>
at node_modules/@react-native/polyfills/error-guard.js:49:36 in ErrorUtils.reportFatalError

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 22 (5 by maintainers)

Most upvoted comments

its very strange in the xcode the project run without problems:

image

but in the vscode it doesn’t works afert run expo prebuild: image

and run expo run:ios

expo run:ios

If you encounter any issues, please report them to https://github.com/expo/expo-cli/issues

expo-cli supports following Node.js versions:
* >=12.13.0 <15.0.0 (Maintenance LTS)
* >=16.0.0 <17.0.0 (Active LTS)

┌─────────────────────────────────────────────────────────────────────────┐
│                                                                         │
│   There is a new version of expo-cli available (6.2.1).                 │
│   You are currently using expo-cli 6.0.8                                │
│   Install expo-cli globally using the package manager of your choice;   │
│   for example: `npm install -g expo-cli` to get the latest version      │
│                                                                         │
└─────────────────────────────────────────────────────────────────────────┘

This command is being executed with the global Expo CLI. Learn more.
To use the local CLI instead (recommended in SDK 46 and higher), run:
› npx expo run:ios

› Skipping dev server
› Planning build
› Compiling react-native-safe-area-context Pods/react-native-safe-area-context » react-native-safe-area-context-dummy.m

❌  (ios/Pods/Headers/Public/RCTTypeSafety/RCTTypeSafety.modulemap:1:8)

> 1 | module RCTTypeSafety {
    |        ^ redefinition of module 'RCTTypeSafety'
  2 |   umbrella header "RCTTypeSafety-umbrella.h"
  3 | 
  4 |   export *


❌  (ios/Pods/Headers/Public/React-Core/React/React-Core.modulemap:1:8)

> 1 | module React {
    |        ^ redefinition of module 'React'
  2 |   umbrella header "React-Core-umbrella.h"
  3 | 
  4 |   export *


❌  (ios/Pods/Headers/Public/ReactCommon/ReactCommon.modulemap:1:8)

> 1 | module ReactCommon {
    |        ^ redefinition of module 'ReactCommon'
  2 |   umbrella header "ReactCommon-umbrella.h"
  3 | 
  4 |   export *


❌  (ios/Pods/Headers/Public/folly/RCT-Folly.modulemap:1:8)

> 1 | module folly {
    |        ^ redefinition of module 'folly'
  2 |   umbrella header "RCT-Folly-umbrella.h"
  3 | 
  4 |   export *


❌  (ios/Pods/Headers/Public/yoga/Yoga.modulemap:1:8)

> 1 | module yoga {
    |        ^ redefinition of module 'yoga'
  2 |   umbrella header "Yoga-umbrella.h"
  3 | 
  4 |   export *

› Compiling react-native Pods/glog » demangle.cc
› Compiling react-native Pods/fmt » fmt-dummy.m
› Compiling react-native Pods/Yoga » event.cpp
› Compiling react-native Pods/ReactCommon » RCTBlockGuard.mm

❌  (ios/Pods/Headers/Public/React-Core/React/React-Core.modulemap:1:8)

> 1 | module React {
    |        ^ redefinition of module 'React'
  2 |   umbrella header "React-Core-umbrella.h"
  3 | 
  4 |   export *


❌  (ios/Pods/Headers/Public/folly/RCT-Folly.modulemap:1:8)

> 1 | module folly {
    |        ^ redefinition of module 'folly'
  2 |   umbrella header "RCT-Folly-umbrella.h"
  3 | 
  4 |   export *


❌  (ios/Pods/Headers/Public/yoga/Yoga.modulemap:1:8)

> 1 | module yoga {
    |        ^ redefinition of module 'yoga'
  2 |   umbrella header "Yoga-umbrella.h"
  3 | 
  4 |   export *

› Compiling react-native Pods/React-logger » React-logger-dummy.m
› Compiling react-native Pods/React-perflogger » BridgeNativeModulePerfLogger.cpp
› Compiling react-native Pods/React-jsinspector » InspectorInterfaces.cpp
    Run script build phase 'Start Packager' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'ZerelParksharing' from project 'ZerelParksharing')
    Run script build phase 'Bundle React Native code and images' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'ZerelParksharing' from project 'ZerelParksharing')
    Run script build phase '[CP-User] Generate app.config for prebuilt Constants.manifest' will be run during every build because it does not specify any outputs. To address this warning, either add output dependencies to the script phase, or configure it to run in every build by unchecking "Based on dependency analysis" in the script phase. (in target 'EXConstants' from project 'Pods')

› 8 error(s), and 3 warning(s)

Failed to build iOS project. "xcodebuild" exited with error code 65.

 example of expo project running on my mac
![image](https://user-images.githubusercontent.com/30758309/216027944-78b3e77d-67a3-4fe5-8081-748a0ee3cfd0.png)





I see. I’ve never used expo start before.

I’d been testing with expo run:ios. This does work.

What’s the difference between expo start and expo run:ios?