question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Throw an exception if native modules are being rebuilt and the host platform is not the target platform

See original GitHub issue
  • I have read the contribution documentation for this project.
  • I agree to follow the code of conduct that this project follows, as appropriate.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

I am using windows server 2012 R2 X64 as the main develop server, when i am packing my project i get for windows X32/X64 everything are good, when i am create package for linux x32/x64 and i am trying to run it in linux ubuntu 16.04, i getting error from the node native module that i installed (work fine in windows), the module is “serialport”.

this is the error that i get when i am trying to run the project:

A JavaScript error occurred in the main process Uncaught Exception: Error: /home/pos/dp-linux-x64/resources/app/node_modules/serialport/build/Release/serialport.node: invalid ELF header at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20) at Object.Module._extensions…node (module.js:598:18) at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at bindings (/home/pos/dp-linux-x64/resources/app/node_modules/bindings/bindings.js:81:44) at Object.<anonymous> (/home/pos/dp-linux-x64/resources/app/node_modules/serialport/lib/bindings/linux.js:2:36)

(dp:9425): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion ‘G_IS_DBUS_CONNECTION (connection)’ failed

(dp:9425): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion ‘G_IS_DBUS_CONNECTION (connection)’ failed

(dp:9425): GLib-GIO-CRITICAL **: g_dbus_connection_get_unique_name: assertion ‘G_IS_DBUS_CONNECTION (connection)’ failed

(dp:9425): GConf-WARNING **: Client failed to connect to the D-BUS daemon: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

after that i amd trying to rebuild the ,odule in ubuntu and replcae the folder in npm mudules, then i get that the version of node are diffrents:

(dp:9687): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion ‘G_IS_DBUS_CONNECTION (connection)’ failed

(dp:9687): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion ‘G_IS_DBUS_CONNECTION (connection)’ failed

(dp:9687): GLib-GIO-CRITICAL **: g_dbus_connection_get_unique_name: assertion ‘G_IS_DBUS_CONNECTION (connection)’ failed START A JavaScript error occurred in the main process Uncaught Exception: Error: The module ‘/home/pos/dp-linux-x64/resources/app/node_modules/serialport/build/Release/serialport.node’ was compiled against a different Node.js version using NODE_MODULE_VERSION 46. This version of Node.js requires NODE_MODULE_VERSION 54. Please try re-compiling or re-installing the module (for instance, using npm rebuild ornpm install). at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:173:20) at Object.Module._extensions…node (module.js:598:18) at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:173:20) at Module.load (module.js:488:32) at tryModuleLoad (module.js:447:12) at Function.Module._load (module.js:439:3) at Module.require (module.js:498:17) at require (internal/module.js:20:19) at bindings (/home/pos/dp-linux-x64/resources/app/node_modules/bindings/bindings.js:81:44) at Object.<anonymous> (/home/pos/dp-linux-x64/resources/app/node_modules/serialport/lib/bindings/linux.js:2:36)

(dp:9687): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion ‘G_IS_DBUS_CONNECTION (connection)’ failed

(dp:9687): GLib-GIO-CRITICAL **: g_dbus_connection_register_object: assertion ‘G_IS_DBUS_CONNECTION (connection)’ failed

(dp:9687): GLib-GIO-CRITICAL **: g_dbus_connection_get_unique_name: assertion ‘G_IS_DBUS_CONNECTION (connection)’ failed

(dp:9687): GConf-WARNING **: Client failed to connect to the D-BUS daemon: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.

Console output when you run electron-forge with the environment variable DEBUG=electron-forge:*. (Instructions on how to do so here). Please include the stack trace if one exists.

Put the console output here

What command line arguments are you passing?

Put the arguments here

What does your config.forge data in package.json look like?

  "config": {
    "forge": {
      "make_targets": {
        "win32": [
          "squirrel"
        ],
        "darwin": [
          "zip"
        ],
        "linux": [
          "deb",
          "rpm"
        ]
      },
      "electronPackagerConfig": {
        "icon": "./DokoPoint.ico",
        "packageManager": "npm",
        "platform": "all",
        "arch": "all"
      },
      "electronWinstallerConfig": {
        "name": "dp"
      },
      "electronInstallerDebian": {},
      "electronInstallerRedhat": {},
      "github_repository": {
        "owner": "",
        "name": ""
      },
      "windowsStoreConfig": {
        "packageName": "",
        "name": "dp"
      }
    }
  },

please help as soon as posible its very urgent for me, thanks 👍

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
maleptcommented, Dec 4, 2017

Are you trying to build a package for a Linux target platform on a Windows host platform? If so, that won’t work because Node doesn’t have a concept of cross-compiling native modules.

0reactions
MarshallOfSoundcommented, Jan 2, 2018

@malept The easiest way to do this is to provide our own walker to rebuild and make rebuild export the logic it uses to determine if a Module is a native module or not 👍

I’ll look at tackling that next week when I’m not on beach wifi 😆

Read more comments on GitHub >

github_iconTop Results From Across the Web

Throw an exception if native modules are being rebuilt and the ...
Rebuilding the native module won't work if your target platform is not the same as the host platform. You'll need to use a...
Read more >
Could not find the following native modules after upgrading ...
config.js file in project folder. const ios = require('@react-native-community/cli-platform-ios'); const android = require('@ ...
Read more >
Common error troubleshooting for Azure App Service and IIS ...
Provides troubleshooting advice for the most common errors when hosting ASP.NET Core apps on Azure Apps Service and IIS.
Read more >
Conditional Compilation - Unity - Manual
It prints a message that depends on the platform you have selected for your target build. First of all, select the platform you...
Read more >
module gnu.targets.arm.GCArmv6
This module defines an embedded target for Linux on Arm. The target generates code ... Note that this field should not be confused...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found