Skip to content

Potentially Path issues #16

@dittmarconsulting

Description

@dittmarconsulting

Hi all,

I have used this package before and it worked like a treat. Thanks for maintaining this repo. 🙏

Right now I'm using this package in a mono-repo with the following file structure

mono-repo
|- packages
|   |- nodetestapp (RN)
|   |   |- android
|   |   |- ios
|   |   |- nodejs-assets
|   |   |   |- nodejs-project
|   |   |       |- nodejs-project
|   |   |          |- main.js
|   |   |          |- package.json
|   |   |          |- node_modules
|   |   |- src (all the RN stuff)
|   |   |- index.js
|   |- web
|- node_modules

and I'm using that setup

node: v16.14.2
react: 17.0.2
react-native: 0.67.0
nodejs-mobile-react-native: 0.8.0

I have updated all the paths to the node_modules in the script files in the Build Phases and everything builds and runs fine in ios (I'm not worried about Android yet)

My entry component looks like that. Very basic for testing:

import React, { ReactElement, useEffect } from 'react';
import { View, Text } from 'react-native';
import nodejs from 'nodejs-mobile-react-native';

const App = (): ReactElement => {
  useEffect(() => {
    nodejs.start('main.js');
  });

  return <View><Text>App</Text></View>;
};

export default App;

When I run the app without the line nodejs.start('main.js'); I have no errors and I can see the App text on the screen but as soon as I run it with the above command, I can see this error in XCode.

2022-03-30 15:43:44.589685+1100 nodetestapp[24155:2166769] [javascript] Invariant Violation: Module HMRClient is not a registered callable module (calling setup). 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.
2022-03-30 15:43:44.591609+1100 nodetestapp[24155:2166769] [javascript] Invariant Violation: No callback found with cbID 2 and callID 1 for module <unknown>. Args: '[{"app_state":"active"}]'
2022-03-30 15:43:44.592940+1100 nodetestapp[24155:2166769] [javascript] Invariant Violation: Module RCTDeviceEventEmitter is not a registered callable module (calling emit). 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.
2022-03-30 15:43:44.593771+1100 nodetestapp[24155:2166769] [javascript] Invariant Violation: Module RCTLog is not a registered callable module (calling logIfNoNativeHook). 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.
2022-03-30 15:43:44.595324+1100 nodetestapp[24155:2166769] [javascript] Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication). 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.

Any hint on how I can resolve this problem would be much appreciated. Perhaps a path that is somehow hardcoded that would prevent me to run this app in a mono-repo or something?

Cheers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions