-
-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Potentially Path issues #16
Comments
I can confirm that is a path issue. I just created a fresh app with this setup
and it works as expected as the Unfortunately, I have to get it to work in a yarn workspaces (aka mono-repo) environment. |
@dittmarconsulting Thanks for the thorough report with details. It seems indeed that it is a configuration issue involving yarn, metro (the bundler React Native uses) and potentially other tools. I don't see this as being specific to nodejs-mobile-react-native |
Thanks for the fast reply @staltz I tried to log out some I could see that the method file was indeed invoked with the working app and it printed out the paths but for the RN app in the mono-repo, this file didn't even run nor did the It seems the pre-compiler doesn't even start metro if the |
UPDATE I found the culprit for the compiler error. I always used @carimus/metro-symlinked-deps in all my mono-repos to link to other projects within the packages folder. Once I removed that I can run the RN app in the mono-repo with this metro setup const path = require('path');
const extraNodeModules = {
'react-native': path.resolve(__dirname, '../../node_modules/react-native'),
src: path.resolve(__dirname, '../../node_modules/'),
};
module.exports = {
projectRoot: __dirname,
watchFolders: [path.resolve(__dirname, '../../node_modules')],
transformer: {
sourceExts: ['.native.ts', '.native.tsx', '.ts', '.tsx', '.js'],
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: true,
},
}),
},
resolver: {
extraNodeModules: new Proxy(extraNodeModules, {
get: (target, name) =>
name in target
? target[name]
: path.join(process.cwd(), `node_modules/${name}`),
}),
},
}; But there is one thing I don't understand and maybe you can help me to figure it out. I added a Then I logged out the
I assume the thread is running now. The
I believe though, the //Start node, with argc and argv.
node_start(argument_count, argv); @staltz Do you have a clue what else I can do? |
UPDATE 2 This is crazy. The entire time I thought NODE is not working as I didn't get any events back from the The fact is, I just send an IoT message and it worked. That means I can successfully send a msg from RN to import nodejs from 'nodejs-mobile-react-native';
nodejs.channel.post('some-listener-name', someData); but any event sent from the I tried Maybe that is something you might help me with? @staltz |
UPDATE 3 I tried to add the NativeAppEventEmitter.addListener('nodejs-mobile-react-native-message', e => {
console.log('Data received !!!!', e);
}); So, for some reason, the |
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
and I'm using that setup
I have updated all the paths to the
node_modules
in the script files in theBuild Phases
and everything builds and runs fine inios
(I'm not worried about Android yet)My entry component looks like that. Very basic for testing:
When I run the app without the line
nodejs.start('main.js');
I have no errors and I can see theApp
text on the screen but as soon as I run it with the above command, I can see this error in XCode.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
The text was updated successfully, but these errors were encountered: