Missing darwin-arm64 build
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 [email protected] and [email protected] (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
-
Ensure Correct Node.js Version: Verify using
node -vandarchcommands.archshould returnarm64. -
Clear Existing Modules:
- Remove
node_modulesandpackage-lock.json:rm -rf node_modules rm package-lock.json
- Remove
-
Reinstall Node Modules:
- Run
npm installoryarnto reinstall dependencies.
- Run
-
Rebuild Specific Modules:
- Explicitly rebuild
bcryptforarm64:npm rebuild bcrypt --build-from-source
- Explicitly rebuild
- Retry Running the Application.
Alternative Solution
- Use an x86_64 emulation mode (Rosetta) to run the Node.js process, if native
arm64resolution 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
bcryptmodule in a Node.js application running on anarm64architecture (Apple Silicon, M1/M2 chips). The error indicates a mismatch in the compiled architecture of thebcryptmodule (compiled forx86_64) and the running Node.js process (requiresarm64).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
Ensure Correct Node.js Version: Verify using
node -vandarchcommands.archshould returnarm64.Clear Existing Modules:
- Remove
node_modulesandpackage-lock.json:rm -rf node_modules rm package-lock.jsonReinstall Node Modules:
- Run
npm installoryarnto reinstall dependencies.Rebuild Specific Modules:
- Explicitly rebuild
bcryptforarm64:npm rebuild bcrypt --build-from-sourceRetry Running the Application.
Alternative Solution
- Use an x86_64 emulation mode (Rosetta) to run the Node.js process, if native
arm64resolution 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!