Giter Site home page Giter Site logo

Comments (9)

j-f1 avatar j-f1 commented on August 19, 2024

Does he Node module syntax not work for you?

from registry-js.

yanlinsun avatar yanlinsun commented on August 19, 2024

No.
It says 'Module did not self-register' if I use node module syntax.
My node version is 10.15.3
Electron version 6.0.3

from registry-js.

shiftkey avatar shiftkey commented on August 19, 2024

It says 'Module did not self-register' if I use node module syntax.

@yanlinsun I believe this is a different error, and I wrote some notes about understanding the issue over in atom/node-keytar#215 (comment) because I think your setup is leading to the wrong version being chosen by prebuild.

from registry-js.

yanlinsun avatar yanlinsun commented on August 19, 2024

@shiftkey I tried the electron-rebuild but no luck. I even tried different registry-js versions, not working.
Actually, the node module requires syntax does working if I run 'renderer.js' with node. But it seems not working with electron.
I test using electron-quick-start project and registry-js only, I have attached the project. Also, there are logs of installing registry-js. Would you take a look? Thanks.
electron-quick-start.zip

from registry-js.

shiftkey avatar shiftkey commented on August 19, 2024

Actually, the node module requires syntax does working if I run 'renderer.js' with node. But it seems not working with electron.

This is unsurprising, because of mismatches between Node and Electron that aren't being handled correctly.

From the registry-js-1.8.0-install.log file, here's the failure fo 1.8.0:

prebuild-install info begin Prebuild-install version 5.3.0
prebuild-install info looking for cached prebuild @ C:\Users\ysun\AppData\Roaming\npm-cache\_prebuilds\e4858a-registry-js-v1.8.0-node-v64-win32-x64.tar.gz
prebuild-install info found cached prebuild
prebuild-install info unpacking @ C:\Users\ysun\AppData\Roaming\npm-cache\_prebuilds\e4858a-registry-js-v1.8.0-node-v64-win32-x64.tar.gz
prebuild-install info unpack resolved to C:\Users\ysun\Workspaces\Private\electron-quick-start\node_modules\registry-js\build\Release\registry.node
prebuild-install WARN install Module did not self-register.

Notice how this is choosing registry-js-v1.8.0-node-v64-win32-x64.tar.gz - that's not the right file at all. The rest of the log is it trying to build the native module against node 10.15.3 which I guess is the version you have installed currently.

It's not clear to me how that you're using electron-rebuild correctly - it needs to be run after installing any packages but before you launch the app. I think that's the missing part here.

from registry-js.

yanlinsun avatar yanlinsun commented on August 19, 2024

Failed attempts 1

I did run electron-rebuild right after I install registry-js, then run npm start.

$ ./node_modules/.bin/electron-rebuild -f -v 6.0.3 -w registry-js
- Searching dependency tree
√ Rebuild Complete

But the error is still the same. I notice that the files in node_modules/registry-js does not change at all after I run the electron-rebuild. I tried to run using electron-rebuild.cmd, not work either.

Failed attempts 2

I tried to rename the registry-js-v1.8.0-electron-v73-win32-x64.tar.gz to registry-js-v1.8.0-electron-v64-win32-x64.tar.gz. Then copy it into npm-cache/_prebuilds folder and re-install registry-js in electron-quick-start project again. I am trying to fool the npm to use v73 instead of v64 and the "fool" is working according to the log. However, this does not solve the problem. I notice there is a warning message in the log.

> [email protected] install C:\Users\ysun\Workspaces\Private\electron-quick-start\node_modules\registry-js
> prebuild-install || node-gyp rebuild

prebuild-install info begin Prebuild-install version 5.3.0
prebuild-install info looking for cached prebuild @ C:\Users\ysun\AppData\Roaming\npm-cache\_prebuilds\e4858a-registry-js-v1.8.0-node-v64-win32-x64.tar.gz
prebuild-install info found cached prebuild
prebuild-install info unpacking @ C:\Users\ysun\AppData\Roaming\npm-cache\_prebuilds\e4858a-registry-js-v1.8.0-node-v64-win32-x64.tar.gz
prebuild-install info unpack resolved to C:\Users\ysun\Workspaces\Private\electron-quick-start\node_modules\registry-js\build\Release\registry.node
prebuild-install WARN install Module did not self-register. <--- WARNING message

C:\Users\ysun\Workspaces\Private\electron-quick-start\node_modules\registry-js>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp info it worked if it ends with ok
gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild' ]
gyp info using [email protected]
gyp info using [email protected] | win32 | x64 <--- Building against node

Working version

After some tweak, I managed to get a working version. This is what I did.

  1. clone registry-js from github
  2. npm run electron-prebuild
  3. cp build/Release/registry.node ../electron-quick-start/node_modules/registry-js/build/Release
    Then it finally worked in electron.

Update

The above only works in the electron-quick-start project, not working in my other project. I am working on it.
My other project works as well after I run npm update. I think some part of the electron gets updated, as I can see some file changes in node_module/electron/dist folder, even the electron --version shows no difference after the update.

Conclusion

I believe this is because of the npm install compiles the registry.node against node, not electron. But how this happens I do not know. And the electron-rebuild seems not doing anything as the file in node_module/registry-js never touched. Is there any setting wrong in my environment?

from registry-js.

yanlinsun avatar yanlinsun commented on August 19, 2024

I find out that the electron-rebuild only work if I put 'registry-js' in "dependencies" section in package.json. It does not work if I put it under 'devDependenies' section.

from registry-js.

shiftkey avatar shiftkey commented on August 19, 2024

I find out that the electron-rebuild only work if I put 'registry-js' in "dependencies" section in package.json. It does not work if I put it under 'devDependenies' section.

Aha, this is helpful context. Thanks for digging into it @yanlinsun!

from registry-js.

yanlinsun avatar yanlinsun commented on August 19, 2024

I didn't use the electron-rebuild correctly. By default, it looks for productive dependencies and rebuilds.
To use electron-rebuild for devDependencies, use the following command:
./node_modules/.bin/electron-rebuild -t dev

from registry-js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.