React-native-background-geolocation: not linking, got `applyPatch` error on RN 0.59.4

Created on 12 Apr 2019  路  10Comments  路  Source: mauron85/react-native-background-geolocation


Your Environment


  • Plugin version: 0.5.3
  • Platform: Android
  • OS version: -
  • Device manufacturer and model: -
  • Running in Simulator: -
  • React Native version: 0.59.4
  • Plugin configuration options: -
  • Link to your project: -

Context

Lib not linking

Expected Behavior

react-native link @mauron85/react-native-background-geolocation and i got message of success link

Actual Behavior


react-native link @mauron85/react-native-background-geolocation and i got next errors:

internal/modules/cjs/loader.js:605
    throw err;
    ^

Error: Cannot find module 'react-native/local-cli/link/android/patches/applyPatch'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
    at Function.Module._load (internal/modules/cjs/loader.js:529:25)
    at Module.require (internal/modules/cjs/loader.js:658:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    ...

Possible Fix

i got this error after upgrade react-native to 0.59, maybe library not support this version

Steps to Reproduce


  1. react-native link @mauron85/react-native-background-geolocation on react-native 0.59.4 version

Context

can't use library

Debug logs

info Linking "@mauron85/react-native-background-geolocation" iOS dependency
info iOS module "@mauron85/react-native-background-geolocation" has been successfully linked
info Linking "@mauron85/react-native-background-geolocation" Android dependency
info Android module "@mauron85/react-native-background-geolocation" has been successfully linked
internal/modules/cjs/loader.js:605
    throw err;
    ^

Error: Cannot find module 'react-native/local-cli/link/android/patches/applyPatch'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
    at Function.Module._load (internal/modules/cjs/loader.js:529:25)
    at Module.require (internal/modules/cjs/loader.js:658:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/Users/amasalov/git/my-project/node_modules/@mauron85/react-native-background-geolocation/scripts/postlink.js:14:22)
    at Module._compile (internal/modules/cjs/loader.js:722:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:733:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)
/Users/amasalov/git/my-project/node_modules/@react-native-community/cli/build/tools/getHooks.js:37
        throw new Error(`Error occurred during executing "${command}" command`);
        ^

Error: Error occurred during executing "node node_modules/@mauron85/react-native-background-geolocation/scripts/postlink.js" command
    at ChildProcess.commandProcess.on.code (/Users/amasalov/git/my-project/node_modules/@react-native-community/cli/build/tools/getHooks.js:37:15)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:978:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
inprogress stale upstream_change

Most helpful comment

@mauron85 It seems that the npm version doesn't include this patch yet?

All 10 comments

Seems they removed link patches. Need to adjust plugin accordingly.

Hi, @itslooklike, if you follow the manually steps, you won't have this problem.

At settings.gradle, on android folder, I just add:

include ':@mauron85_react-native-background-geolocation-common'
project(':@mauron85_react-native-background-geolocation-common').projectDir = new File(rootProject.projectDir, '../node_modules/@mauron85/react-native-background-geolocation/android/common')
include ':@mauron85_react-native-background-geolocation'
project(':@mauron85_react-native-background-geolocation').projectDir = new File(rootProject.projectDir, '../node_modules/@mauron85/react-native-background-geolocation/android/lib')

And solve this problem.

I guess this cause is the following changes:

The CLI tools have been moved to a new repository,

https://facebook.github.io/react-native/blog/#cli-improvements

If we make the import repository to '@react-native-community/cli/build/commands/link/android/patches', we will success the 'react-native link' command.

I sent the patch (PR #374).

Best regards.

Patch has been merged. Thanks.

@mauron85 It seems that the npm version doesn't include this patch yet?

It does now, but not sure it will work. It may still be missing the react-native-community pkg. Check PR for updates.

It's not working....any possible work around for time-being till we get it fixed?

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically closed, because it has not had recent activity. If you believe this issue shouldn't be closed, please reopen or write down a comment requesting issue reopening with explanation why you think it's important. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings