Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't login a user using bcrypt (dyld: Symbol not found)

When I try to login a user using bcrypt.compare to compare passwords, this error message show up in my terminal.

dyld: lazy symbol binding failed: Symbol not found: __ZN4node19GetCurrentEventLoopEPN2v87IsolateE
  Referenced from: /pathTo/node_modules/bcrypt/lib/binding/bcrypt_lib.node
  Expected in: flat namespace

dyld: Symbol not found: __ZN4node19GetCurrentEventLoopEPN2v87IsolateE
  Referenced from: /pathTo/node_modules/bcrypt/lib/binding/bcrypt_lib.node
  Expected in: flat namespace

I am using node.js and express.

like image 821
JulienRioux Avatar asked Sep 27 '18 20:09

JulienRioux


1 Answers

That's how I've solve it. If this happen to you, you might try to install the bcryptjs package (yarn add bcryptjs) and replace:

const bcrypt = require("bcrypt");`

by:

const bcrypt = require("bcryptjs");

Hope it will work for you too!

like image 170
JulienRioux Avatar answered Oct 20 '22 06:10

JulienRioux