Open raphael10-collab opened 3 years ago
@raphael10-collab is the sodium prebuild not working for you? normally you'd never rebuild sodium
Hi @mafintosh !
The problem comes from here:
(base) marco@pc01:~/webMatters/electronMatters/GGC$ yarn start
yarn run v1.22.5
$ npm run build && electron ./dist/main.js
> GGC@1.0.0 build /home/marco/webMatters/electronMatters/GGC
> tsc
ℹ️ ggc/desktop/ConfigurationPersistence [2020-12-02 19:11:32] Reading config file from "/home/marco/.config/GGC/config
/init.json" ...
ℹ️ ggc/desktop/ConfigurationPersistence [2020-12-02 19:11:32] Inizializing ConfigurationPersistence
ℹ️ ggc/desktop/ConfigurationPersistence [2020-12-02 19:11:32] Restore "locale"
ℹ️ ggc/desktop/ConfigurationPersistence [2020-12-02 19:11:32] Restore "env"
ℹ️ ggc/desktop/ConfigurationPersistence [2020-12-02 19:11:32] Restore "enableSpellChecking"
ℹ️ ggc/desktop/ConfigurationPersistence [2020-12-02 19:11:32] Restore "showMenu"
ℹ️ ggc/desktop/ConfigurationPersistence [2020-12-02 19:11:32] Restore "shouldAutoLaunch"
App threw an error during load
Error: The module '/home/marco/webMatters/electronMatters/GGC/node_modules/sodium-native/build/Release/sodium.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 85. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at process.func [as dlopen] (electron/js2c/asar_bundle.js:5:1812)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1203:18)
at Object.func [as .node] (electron/js2c/asar_bundle.js:5:1812)
at Module.load (internal/modules/cjs/loader.js:992:32)
at Module._load (internal/modules/cjs/loader.js:885:14)
at Function.f._load (electron/js2c/asar_bundle.js:5:12694)
at Module.require (internal/modules/cjs/loader.js:1032:19)
at require (internal/modules/cjs/helpers.js:72:18)
at load (/home/marco/webMatters/electronMatters/GGC/node_modules/node-gyp-build/index.js:21:10)
at Object.<anonymous> (/home/marco/webMatters/electronMatters/GGC/node_modules/sodium-native/index.js:1:39)
A JavaScript error occurred in the main process
Uncaught Exception:
Error: The module '/home/marco/webMatters/electronMatters/GGC/node_modules/sodium-native/build/Release/sodium.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 85. Please try re-compiling or re-installing
the module (for instance, using `npm rebuild` or `npm install`).
at process.func [as dlopen] (electron/js2c/asar_bundle.js:5:1812)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1203:18)
at Object.func [as .node] (electron/js2c/asar_bundle.js:5:1812)
at Module.load (internal/modules/cjs/loader.js:992:32)
at Module._load (internal/modules/cjs/loader.js:885:14)
at Function.f._load (electron/js2c/asar_bundle.js:5:12694)
at Module.require (internal/modules/cjs/loader.js:1032:19)
at require (internal/modules/cjs/helpers.js:72:18)
at load (/home/marco/webMatters/electronMatters/GGC/node_modules/node-gyp-build/index.js:21:10)
at Object.<anonymous> (/home/marco/webMatters/electronMatters/GGC/node_modules/sodium-native/index.js:1:39)
This is why I tried to use electron-rebuild.
That looks like a pretty old version of sodium, can you check somehow?
Sorry for the question... how to check the version of the sodium lib? I didn't find any reference in /node_modules/node-gyp/package.json and /node_modules/hyperswarm/package
You can see the path in the problem you posted here https://github.com/hyperswarm/hyperswarm/issues/70#issuecomment-737438666, ie /home/marco/webMatters/electronMatters/GGC/node_modules/sodium-native/package.json
But I see now also that, that dep was rebuilt as well. In general don't rebuild sodium, utp-native or any of the prebuilds we ship. It'll create a lot more problems like this with interop than if you don't :)
/home/marco/webMatters/electronMatters/GGC/node_modules/sodium-native/package.json :
"version": "2.4.9"
Do you think that upgrading sodium-native to the latest version would solve the problem, or should I only re-install hyperswarm?
Yes, very likely
On 2 Dec 2020, at 20.37, raphael10-collab notifications@github.com wrote:
/home/marco/webMatters/electronMatters/GGC/node_modules/sodium-native/package.json :
"version": "2.4.9" Do you think that upgrading sodium-native to the latest version would solve the problem?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Now /home/marco/webMatters/electronMatters/GGC/node_modules/sodium-native/package.json :
"version": "3.2.0"
Still get:
App threw an error during load
Error: The module '/home/marco/webMatters/electronMatters/GGC/node_modules/noise-protocol/node_modules/sodium-native
/build/Release/sodium.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 83. This version of Node.js requires
NODE_MODULE_VERSION 85. Please try re-compiling or re-installing
I removed node_modules folder and yarn.lock file. Then I re-installed all the packages. But still the same problem.
Could it be that you updated sodium-native
to the latest version but noise-protocol
has its own sodium-native
dependency? npm usually does this whenever you want a version of package that is incompatible with the version that a dependency wants; In this case, npm nests the dependency's package. You can use npm ls
to see the version of the nested dependency, maybe this will help.
Latest noise-protocol uses latest sodium also. All of the hyper* deps are on sodium 3.
But since you have a build folder inside sodium above, something is still rebuilding. Did you clean out all your deps and reinstalled? You sure nothing is compiling or that you aren't recompiling anything?
When you recompile you loose the cross node/electron compat that the prebuilds give you.
This is the complete list of dependencies obtained through yarn list
command:
yarnList.txt
I'm trying to distill from your kind suggestions the steps I need to follow.
From the complete list of dependencies I see that sodium is version 3.something in these packages: @hyperswarm/dht@4.0.1 , @hyperswarm/hypersign@2.1.1, blake2b-universal@1.0.1, dht-rpc@4.9.6 .
But it is version 2.something as dependency in other packages: hmac-blake2b@0.2.0 , hypercore-crypto@1.0.0 hypercore@8.14.0 hypermerge@2.0.0-beta.25 noise-peer@1.1.0 noise-protocol@1.0.0 secretstream-stream@1.2.1 simple-hypercore-protocol@1.5.0 sodium-universal@2.0.0
So...should I remove the sodium dependency of each package if it is version 2.something, and re-install it @latest or should I do something else?
What's pulling in those deps with version 2? Nothing in our stack should be doing that.
Sorry Mathias. May be to my lack of knowledge, I do not understand. Should I upgrade every sodium package to version 3?
@raphael10-collab no problem, let me try to be a bit more clear.
Some parent dep in your dependency tree in your project is pulling in a legacy dep that uses sodium 2. For me to easier help you i need to know what parent dep that is. Could you post the output of npm ls from your project? Then I can take a look :)
@mafintosh this is the complete dependencies tree: yarnList.txt
I think that list is deduped, but I think hypermerge in there needs a hypercore major bump. We should make an issue for that on that repo. You are using that one yea?
I now redone the same list with this command: yarn list > yarnList.txt : yarnList.txt
Yes, I'm using hypercore. I can make an issue in github for hypercore's library asking for upgrading their sodium dependencies. And it would be helpful if you can give them your voice as well
It's not hypercore, Hypercore is using latest sodium. It's the dep that's using an old version of Hypercore that needs to be bumped to use latest Hypercore, among those is Hypermerge (which we don't maintain)
@mafintosh I just made an issue in Hypermerge's GitHub page about the version of Hypercore used: https://github.com/automerge/hypermerge/issues/88
In my electron-react-typescript project I added hyperswarm:
When electron-rebuild-ing :
Other info:
How to solve the problem?