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.

Rebuilding native modules directory naming issue

See original GitHub issue

When rebuilding with the serialport module, it names the final directory as

electron-v0.34.1-darwin-x64

However, when ran with the executable, it is looking for

node-v46-darwin-x64

It seems like in main.js, the directory name and electron versioning is mixed.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
BafScommented, Dec 21, 2015

I have exactly the same problem with sqlite3.

For information: After having installed sqlite and electron-rebuild I did : ./node_modules/.bin/electron-rebuild and it created a .node file at node_modules/sqlite3/lib/binding/electron-v0.36-darwin-x64/node_sqlite3.node. But electron give this error “Uncaught Error: Cannot find module '/Users/me/dev/proj/node_modules/sqlite3/lib/binding/node-v47-darwin-x64/node_sqlite3.node’”

I renamed the folder to node-v47-darwin-x64 and it worked.

Note that in node_modules/sqlite3/build/config.gypi I have the right path

...
"module_path": "../lib/binding/node-v47-darwin-x64",
...

and node_modules/sqlite3/package.json

...
  "binary": {
    "module_name": "node_sqlite3",
    "module_path": "./lib/binding/{node_abi}-{platform}-{arch}",
    "host": "https://mapbox-node-binary.s3.amazonaws.com",
    "remote_path": "./{name}/v{version}/{toolset}/",
    "package_name": "{node_abi}-{platform}-{arch}.tar.gz"
  },
...

PS: This command work (because module_path hard coded): cd node_modules/sqlite3 && node-gyp rebuild --target=0.36.1 --arch=x64 --target_platform=darwin --runtime=electron --module_name=node_sqlite3 --module_path=../lib/binding/node-v47-darwin-x64

1reaction
springmeyercommented, Mar 31, 2016

This is now solved upstream by https://github.com/mapbox/node-pre-gyp/pull/187 - available in node-pre-gyp >= 0.6.25. So, the next step is to ensure that modules you are using that depend and bundle node-pre-gyp get re-tagged with the latest version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rebuilding native modules directory naming issue #33 - GitHub
Rebuilding native modules directory naming issue #33 ... It seems like in main.js, the directory name and electron versioning is mixed.
Read more >
Building native modules as part of electron app - Stack Overflow
The first issue I am running into is the module requires to be manually built by going into the director and manually running...
Read more >
Troubleshooting | React Navigation
If the module points to a local file (i.e. the name of the module starts with ./ ), then it's probably due to...
Read more >
rollup.js
The file should export a function returning a plugin object. Via the name of a plugin that is installed in a local or...
Read more >
electron-rebuild - npm Package Health Analysis - Snyk
Electron supporting package to rebuild native node modules against the currently installed electron For more information about how to use this package see ......
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