node-argon2: 0.25.0 is broken on MacOS

Welcome to the issues section if it’s your first time!

Steps to reproduce

  1. Create a blank node project via npm init -y
  2. Add argon2 via npm i --save argon2
  3. Create an index.js file that consists of just the line var argon2 = require("argon2");
  4. Run node .

Expected behaviour

argon2 should be successfully installed by npm. argon2 should be usable on MacOS

Actual behaviour

npm produces on output when installing argon2 on MacOS:

npm i --save argon2

> argon2@0.25.0 install /private/tmp/foo/node_modules/argon2
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using needle for node-pre-gyp https download
[argon2] Success: "/private/tmp/foo/node_modules/argon2/lib/binding/argon2.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

argon2 cannot be loaded by Node on MacOS:

internal/modules/cjs/loader.js:977
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: dlopen(/private/tmp/foo/node_modules/argon2/lib/binding/argon2.node, 1): no suitable image found.  Did find:
	/private/tmp/foo/node_modules/argon2/lib/binding/argon2.node: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00
	/private/tmp/foo/node_modules/argon2/lib/binding/argon2.node: unknown file type, first eight bytes: 0x7F 0x45 0x4C 0x46 0x02 0x01 0x01 0x00

Environment

Operating system: MacOS Mojave 10.14.6

Node version: v12.9.1

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 22
  • Comments: 35 (13 by maintainers)

Most upvoted comments

Confirmed – same issue here using node or npm

Yep @pe8ter, 0.24.1 still works.

If anyone newer to package versioning comes along, you can install the rollback version with one of the following commands 😃

npm install argon2@0.24.1 or yarn add argon2@0.24.1

@ranisalt - anything any of us can do to help or good for now?

@ranisalt I confirmed 0.25.1 works on macOS.

I just tried this:

  "dependencies": {
    "argon2": "ranisalt/node-argon2"
  }

This causes npm to build the package from source:

➜  foo npm i

> argon2@0.25.0 install /private/tmp/foo/node_modules/argon2
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Tried to download(404): https://github.com/ranisalt/node-argon2/releases/download/v0.25.0/argon2-v0.25.0-node-v72-darwin-x64-unknown.tar.gz
node-pre-gyp WARN Pre-built binaries not found for argon2@0.25.0 and node@12.9.1 (node-v72 ABI, unknown) (falling back to source compile with node-gyp)
  CC(target) Release/obj.target/libargon2/argon2/src/opt.o
  CC(target) Release/obj.target/libargon2/argon2/src/argon2.o
  CC(target) Release/obj.target/libargon2/argon2/src/core.o
  CC(target) Release/obj.target/libargon2/argon2/src/blake2/blake2b.o
  CC(target) Release/obj.target/libargon2/argon2/src/thread.o
  CC(target) Release/obj.target/libargon2/argon2/src/encoding.o
  LIBTOOL-STATIC Release/argon2.a
  CXX(target) Release/obj.target/argon2/src/argon2_node.o
  SOLINK_MODULE(target) Release/argon2.node
  COPY /private/tmp/foo/node_modules/argon2/lib/binding/argon2.node
  TOUCH Release/obj.target/action_after_build.stamp
npm WARN foo@1.0.0 No description
npm WARN foo@1.0.0 No repository field.

updated 1 package and audited 99 packages in 14.004s
found 0 vulnerabilities

Everything works correctly this way.

It appears that when it’s installed via npm, it chooses the wrong prebuilt binaries.

None of the solutions worked for me.

Running npm install argon2@0.24.1:

hmm, odd. Might be a cache/package lock issue. Go nuclear!

  1. Delete node_modules folder
  2. Delete package-lock.json
  3. npm uninstall argon2
  4. npm install
  5. npm install @ version 0.24.1

Does that work? I was able to install in a new directory.

package.json should have

"dependencies: {
       "argon2": "^0.24.1"
}

Somewhere inside of it. So I’m going to guess package-lock issue (hope so at least!)

@ranisalt Did you git push with --tags? If so, probably a bug.

Until we can do the TravisCI upload or #208 is merged, we need to temporary let the user rebuild from source.

If you have time, please deprecate v0.25.0 and publish v0.25.1 without the /lib folder. (not related, but it’s better to use files instead of .gitignore imo)

Sorry that my PR causes so much trouble 😢.