kelektiv/node.bcrypt.js

Missing darwin-arm64 build

rami-carma opened this issue · 3 comments

I am on Apple silicon (M1 Chip) and I am attempting to install bcrypt onto my node.js project (node version:16.16.0) and keep hitting a 404 error on bcrypt 5.0.0.

there seems to be a missing build for this version on darwin-arm64 (which exists on version 5.1.1)

the following errors were thrown when attempting to download

npm ERR! node-pre-gyp info check checked for "/Users/rami/Project/nodejs_public_insight_api/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node" (not found)
npm ERR! node-pre-gyp http GET https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.0/bcrypt_lib-v5.0.0-napi-v3-darwin-arm64-unknown.tar.gz
npm ERR! node-pre-gyp http 404 https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.0/bcrypt_lib-v5.0.0-napi-v3-darwin-arm64-unknown.tar.gz
npm ERR! node-pre-gyp WARN Tried to download(404): https://github.com/kelektiv/node.bcrypt.js/releases/download/v5.0.0/bcrypt_lib-v5.0.0-napi-v3-darwin-arm64-unknown.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not found for bcrypt@5.0.0 and node@16.16.0 (node-v93 ABI, unknown) (falling back to source compile with node-gyp)

same issue, any update?

It works for me:

Issue Description

Problem

Encountered an error related to the bcrypt module in a Node.js application running on an arm64 architecture (Apple Silicon, M1/M2 chips). The error indicates a mismatch in the compiled architecture of the bcrypt module (compiled for x86_64) and the running Node.js process (requires arm64).

Error Message

Error: dlopen(/Users/cichy/Praca/Wlasne/oxapps/oxdata/ox-be/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node, 0x0001): tried: '/Users/cichy/Praca/Wlasne/oxapps/oxdata/ox-be/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/cichy/Praca/Wlasne/oxapps/oxdata/ox-be/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node' (no such file), '/Users/cichy/Praca/Wlasne/oxapps/oxdata/ox-be/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

Steps to Resolve

  1. Ensure Correct Node.js Version: Verify using node -v and arch commands. arch should return arm64.
  2. Clear Existing Modules:
    • Remove node_modules and package-lock.json:
      rm -rf node_modules
      rm package-lock.json
  3. Reinstall Node Modules:
    • Run npm install or yarn to reinstall dependencies.
  4. Rebuild Specific Modules:
    • Explicitly rebuild bcrypt for arm64:
      npm rebuild bcrypt --build-from-source
  5. Retry Running the Application.

Alternative Solution

  • Use an x86_64 emulation mode (Rosetta) to run the Node.js process, if native arm64 resolution fails.

Additional Notes

  • Ensuring consistent use of Node.js binaries matching the system architecture (development/production) is crucial to avoid such issues.

It works for me:

Issue Description

Problem

Encountered an error related to the bcrypt module in a Node.js application running on an arm64 architecture (Apple Silicon, M1/M2 chips). The error indicates a mismatch in the compiled architecture of the bcrypt module (compiled for x86_64) and the running Node.js process (requires arm64).

Error Message

Error: dlopen(/Users/cichy/Praca/Wlasne/oxapps/oxdata/ox-be/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node, 0x0001): tried: '/Users/cichy/Praca/Wlasne/oxapps/oxdata/ox-be/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/cichy/Praca/Wlasne/oxapps/oxdata/ox-be/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node' (no such file), '/Users/cichy/Praca/Wlasne/oxapps/oxdata/ox-be/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

Steps to Resolve

  1. Ensure Correct Node.js Version: Verify using node -v and arch commands. arch should return arm64.

  2. Clear Existing Modules:

    • Remove node_modules and package-lock.json:
      rm -rf node_modules
      rm package-lock.json
  3. Reinstall Node Modules:

    • Run npm install or yarn to reinstall dependencies.
  4. Rebuild Specific Modules:

    • Explicitly rebuild bcrypt for arm64:
      npm rebuild bcrypt --build-from-source
  5. Retry Running the Application.

Alternative Solution

  • Use an x86_64 emulation mode (Rosetta) to run the Node.js process, if native arm64 resolution fails.

Additional Notes

  • Ensuring consistent use of Node.js binaries matching the system architecture (development/production) is crucial to avoid such issues.

I was debugging for 2 hours and found this. This helped me, thank you!