No native build was found for the platform runtime error with electron
See original GitHub issueHow to use this library with webpack in the electron js app? I have an electron js application that uses ffi-napi as a native module. The app works well if I don’t include this library. And if I include this library in the app I’ve to modify node’s global __dirname to true i.e. in the webpack config file: node: {__dirname: true}. This works well in the development mode. But when I build installer then starting an app would throws a runtime error:
Error: No native build was found for platform=darwin arch=x64 runtime=electron abi=87 uv=1 libc=glibc node=14.16.0 electron=12.0.6 webpack=true
With a little bit research I found this library needs a node global __dirname to be set up but in production mode I’m clueless to find what path this library is expecting for. Or how to set correct path that this library needs in order to function properly? Any help would really be appreciated! Thanks.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:5
Top Related StackOverflow Question
@ngiafeno You can either use
allowlistkey insidenodeExternals()function to exclude node modules using negation in regex from the bundle. Say, you want to excludeffi-napimodule from the bundle then:Or the simple of way of excluding node modules without using any plugins or libraries in the webpack:
@abjagtap You need to exclude this library from the bundle. Use
webpack-node-externalsto do so. E.g;