Search code examples
macos-monterey

"../bcrypt_lib.node' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64)))" while running tests


1

Error: dlopen(/Users//Documents/Work/Repo/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node, 0x0001): tried: '/Users//Documents/Work/Repo/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64)))
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1144:18)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:14)
at Module.require (internal/modules/cjs/loader.js:974:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object.<anonymous> (/Users/Documents/Work/node_modules/bcrypt/bcrypt.js:6:16)
at Module._compile (internal/modules/cjs/loader.js:1085:14)
at Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Object.require.extensions.<computed> [as .js] (/Users//Documents/Work/Repo///node_modules/ts-node/src/index.ts:431:14)

any idea how to resolve this issue, new here. please let me know any additional info needed here.


Solution

  • I encountered a similar error and what worked for me was upgrading my node version to a higher one. I was getting the error on node version v14.16.1 but then upgraded to v16.16.0 and the issue disappeared. Also, If you are using Mac M1, maybe make sure that you are using rosetta.