-
Notifications
You must be signed in to change notification settings - Fork 62
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
Strange error on Mac #31
Comments
@michaelspeed Could you provide any details? |
using like this - |
@michaelspeed exec is a child_process method, and node modules can only be used in the main process of electron. *edited for clarity |
Node modules can be used in both the main and render processes of Electron. We're successfully using them in both including native ones. I'm about to use this module in both so I'll let you know if I have trouble. |
@timfish if you mean node modules like fs, spawn, fork, child_process etc, and not npm modules - they are only available from the main process. You can access them from the renderer by using the ipc or remote modules (which runs the code from the main process). I should have been clearer on that. |
No that's not correct. In the renderer you can directly access any node module including all the built in ones. Give it a try! |
You're absolutely correct, @timfish. I checked an old electron project I worked on and we had node integration set to false. That's why I couldn't access nodejs modules from the renderer process. |
Hi... |
bump |
Im also facing this problem aswell. |
Any solution to this yet? Having the same problem on Mac using Electron and React. |
Same issue here! |
Hello!, import { machineIdSync } from 'node-machine-id';
const socket: SocketIOClient.Socket = connect(`${process.env.REACT_APP_SOCKET_IO_SERVER_URL}`, {
query: {
deviceId: machineIdSync()
}
}); |
I don't think it's possible to grab the machine id from the actual react front-end. If you're using Electron try getting the machine id from the main process and passing it through an ipc channel. |
I'm not using electron, but Thanks for replying |
Even in the react app it's not possible for the browser to fetch the machine id. However, an alternative is browser fingerprinting if you don't have a process running in the machine: https://panopticlick.eff.org/static/browser-uniqueness.pdf |
Has anyone found a solution to this? |
i get this error while using it with electron and react
TypeError: (0 , p.exec) is not a function
any ideas whats wrong?
The text was updated successfully, but these errors were encountered: