Skip to content
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

Native node (ZeroMQ) module problems with webpack template #1424

Closed
delewis13 opened this issue Jan 18, 2020 · 3 comments · Fixed by #2320
Closed

Native node (ZeroMQ) module problems with webpack template #1424

delewis13 opened this issue Jan 18, 2020 · 3 comments · Fixed by #2320
Labels
bug plugin/webpack Issues or pull requests related to first-party webpack plugins/templates

Comments

@delewis13
Copy link

Issue Details

Electron Forge Version: 6.0.0-beta.47
Electron Version: v7.1.9
Operating System: macOS 10.14.6
Last Known Working Electron Forge version: Unknown

Expected Behavior

App should start without error.

Actual Behavior

Attempting to use zeroMQ (https://github.com/zeromq/zeromq.js/) with electron-forge webpack template.

App fails to start reporting:

Error: No native build was found for platform=darwin arch=x64 runtime=electron abi=75 uv=1 libc=glibc

To Reproduce

(1) Instantiate new electron app with webpack template
yarn create electron-app my-new-app --template=webpack

(2) Install zeroMQ
yarn add zeromq

(3) Import zeroMQ in main.js
const zmq = require('zeromq')

(4) Start app
yarn start

Additional Information

If the same steps are followed as above but without --template=webpack, no issues are encountered. As such, problem appears to be with the webpack template.

@delewis13 delewis13 added the bug label Jan 18, 2020
@malept malept added the plugin/webpack Issues or pull requests related to first-party webpack plugins/templates label Jan 23, 2020
@stefan-pdx
Copy link

I've come across this same issue. I've tried rebuilding zmq with:

electron-rebuild -f -w zeromq

and

cd node_modules/zeromq
HOME=~/.electron-gyp node-gyp rebuild --target=7.1.10 --arch=x64 --dist-url=https://electronjs.org/headers

but still have the same issue with No native build was found for....

@stefan-pdx
Copy link

I was able to work around this by specifying 5.1.1 of the zeromq package instead of the 6.0 beta. See zeromq/zeromq.js#338 for details

@dstudzinski
Copy link

dstudzinski commented Apr 27, 2020

I had similar problems with leveldown. I think it's related to: #703

I still have this problem with 6.0.0-beta.51 and [email protected] (with webpack and webpack-typescript templates). I was able to fix native modules problem by:

Replacing @marshallofsound/[email protected] with @zeit/[email protected]

and replacing in webpack.rules.js rules:

loader: '@marshallofsound/webpack-asset-relocator-loader',

with

loader: '@zeit/webpack-asset-relocator-loader',

But now I have problem with renderer:

Html Webpack Plugin:
  Error: /project/src/index.html:82
  /******/  __webpack_require__.ab = __dirname + "/assets/";
                                     ^
  ReferenceError: __dirname is not defined

It looks like problem with @marshallofsound/[email protected] (fork is too old?) or maybe something was changed in webpack in electron-forge (related to ASSET_RELOCATOR_BASE_DIR variable)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug plugin/webpack Issues or pull requests related to first-party webpack plugins/templates
Projects
None yet
4 participants