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

argon2 package.json is not node-pre-gyp ready #411

Closed
dotlambda opened this issue Jul 29, 2024 · 13 comments
Closed

argon2 package.json is not node-pre-gyp ready #411

dotlambda opened this issue Jul 29, 2024 · 13 comments

Comments

@dotlambda
Copy link

dotlambda commented Jul 29, 2024

Steps to reproduce

Run npx @mapbox/node-pre-gyp rebuild inside node-argon2's git repo.

Actual behaviour

$ node-pre-gyp rebuild
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@1.0.11
node-pre-gyp info using node@20.14.0 | linux | x64
node-pre-gyp ERR! UNCAUGHT EXCEPTION 
node-pre-gyp ERR! stack Error: argon2 package.json is not node-pre-gyp ready:
node-pre-gyp ERR! stack package.json must declare these properties: 
node-pre-gyp ERR! stack binary.module_name
node-pre-gyp ERR! stack binary.module_path
node-pre-gyp ERR! stack binary.host
node-pre-gyp ERR! stack     at validate_config (/nix/store/23papjdi7hbad05smk29fndmkwys9mzs-node-pre-gyp-1.0.11/lib/node_modules/@mapbox/node-pre-gyp/lib/util/versioning.js:220:11)
node-pre-gyp ERR! stack     at module.exports.evaluate (/nix/store/23papjdi7hbad05smk29fndmkwys9mzs-node-pre-gyp-1.0.11/lib/node_modules/@mapbox/node-pre-gyp/lib/util/versioning.js:279:3)
node-pre-gyp ERR! stack     at clean (/nix/store/23papjdi7hbad05smk29fndmkwys9mzs-node-pre-gyp-1.0.11/lib/node_modules/@mapbox/node-pre-gyp/lib/clean.js:16:27)
node-pre-gyp ERR! stack     at self.commands.<computed> [as clean] (/nix/store/23papjdi7hbad05smk29fndmkwys9mzs-node-pre-gyp-1.0.11/lib/node_modules/@mapbox/node-pre-gyp/lib/node-pre-gyp.js:86:37)
node-pre-gyp ERR! stack     at run (/nix/store/23papjdi7hbad05smk29fndmkwys9mzs-node-pre-gyp-1.0.11/lib/node_modules/@mapbox/node-pre-gyp/lib/main.js:81:30)
node-pre-gyp ERR! stack     at process.processTicksAndRejections (node:internal/process/task_queues:77:11)
node-pre-gyp ERR! System Linux 6.9.10
node-pre-gyp ERR! command "node" "/nix/store/23papjdi7hbad05smk29fndmkwys9mzs-node-pre-gyp-1.0.11/lib/node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp" "rebuild"
node-pre-gyp ERR! cwd /path/to/node-argon2
node-pre-gyp ERR! node -v v20.14.0
node-pre-gyp ERR! node-pre-gyp -v v1.0.11

Environment

Operating system: NixOS

Node version: 20.14.0

Compiler version:

@ranisalt
Copy link
Owner

ranisalt commented Aug 3, 2024

Yeah, it hasn't been since the package moved from @mapbox/node-pre-gyp to node-gyp-build (see b476028)

Is there a need to support @mapbox/node-pre-gyp when not using it directly?

@dotlambda
Copy link
Author

Is there a need to support @mapbox/node-pre-gyp when not using it directly?

I don't think there is but the README should be updated.

@ranisalt
Copy link
Owner

ranisalt commented Aug 3, 2024

Ah, absolutely. Feel free to open a pull request, or I will do it a little later 😉

@SuperSandro2000
Copy link

SuperSandro2000 commented Aug 20, 2024

We only really want to know how to recompile the prebuilt binaries so that they no segfault. We don't really care what tools are used for that 😅

We are receiving the same error as #302 (comment) or #405

@SuperSandro2000
Copy link

We tried rebuilding argon2 with cd node_modules/argon2; node-gyp rebuild but we still receive the error:

App threw an error during load
Error: /nix/store/lw0grjw4jfk7n2lf9vnw0xzxjxa5512v-bitwarden-desktop-2024.7.1/opt/Bitwarden/resources/app.asar.unpacked/node_modules/argon2/build/Release/argon2.node: undefined symbol: argon2_ctx
    at process.func [as dlopen] (node:electron/js2c/node_init:2:2559)
    at Module._extensions..node (node:internal/modules/cjs/loader:1470:18)
    at Object.func [as .node] (node:electron/js2c/node_init:2:2786)
    at Module.load (node:internal/modules/cjs/loader:1215:32)
    at Module._load (node:internal/modules/cjs/loader:1031:12)
    at c._load (node:electron/js2c/node_init:2:17025)
    at Module.require (node:internal/modules/cjs/loader:1240:19)
    at require (node:internal/modules/helpers:179:18)
    at load (/nix/store/lw0grjw4jfk7n2lf9vnw0xzxjxa5512v-bitwarden-desktop-2024.7.1/opt/Bitwarden/resources/app.asar/node_modules/node-gyp-build/node-gyp-build.js:22:10)
    at Object.<anonymous> (/nix/store/lw0grjw4jfk7n2lf9vnw0xzxjxa5512v-bitwarden-desktop-2024.7.1/opt/Bitwarden/resources/app.asar/node_modules/argon2/argon2.cjs:7:32)
A JavaScript error occurred in the main process

First of all: is that correct to rebuild the library now? What are we doing wrong?

@SuperSandro2000
Copy link

@ranisalt Some advice would be helpful here as we are really stuck and in some migration pressure because electron 29 is soonish leaving nixpkgs unstable.

@ranisalt
Copy link
Owner

ranisalt commented Aug 23, 2024

@SuperSandro2000 can you try running npm install --build-from-source? Seems to do what you need according to @mapbox/node-pre-gyp quick help

Edit: --build-from-source takes no argument, and rebuilds everything (hopefully you don't have a lot)

@amarshall
Copy link
Contributor

amarshall commented Aug 25, 2024

node-gyp-ready doesn’t really matter, and is not the cause of the issue. The undefined symbol is due to LTO (for reasons unknown to me). Changing to use LTO was coupled with the change from node-gyp-ready to node-gyp-build (in b476028). I’ve opened #415 to remove LTO from the build, which resolves the issue we were seeing building from source.

@ranisalt
Copy link
Owner

Thanks @amarshall I'll publish v0.41.0 with your fix soon

@ranisalt
Copy link
Owner

After a lot of trouble with npm, it's done 😆 https://www.npmjs.com/package/argon2/v/0.41.0

@ranisalt
Copy link
Owner

@dotlambda @SuperSandro2000 @amarshall can you confirm that it works from your side now?

@SuperSandro2000
Copy link

We don't directly consume this package, we get it proxied through bitwarden.
In nixpkgs we patched a bit and rebuild the library and got things to work https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/bi/bitwarden-desktop/package.nix#L95 .

So I assume this got fixed but we only know for sure with the next updated of bitwarden.

@ranisalt
Copy link
Owner

ranisalt commented Sep 4, 2024

OK, I use Bitwarden myself and will keep an eye out, but I consider this fixed.

@ranisalt ranisalt closed this as completed Sep 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants