Open ArmaanAS opened 1 month ago
Tenative idea to fix: add a cache to NAPI / FFI to not load the same module multiple times across isolate restarts.
What platform are you on? The original reproducer works for me on macOS.
It happens on WSL but also in a Docker container using the denoland/deno
image.
HMR Process started.
$2b$10$4oPUOtBp8tIzp4nUwx270O/3atKdPISkfsLt3LQySORLO/mj5j1CO
HMR Process finished. Restarting on file change...
HMR File change detected! Restarting!
error: Uncaught (in promise) TypeError: Unable to find register Node-API module at /home/user/deno/node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node
at Object.Module._extensions..node (node:module:787:21)
at Module.load (node:module:655:32)
at Function.Module._load (node:module:523:13)
at Module.require (node:module:674:19)
at require (node:module:798:16)
at Object.<anonymous> (file:///home/user/deno/node_modules/bcrypt/bcrypt.js:6:16)
at Object.<anonymous> (file:///home/user/deno/node_modules/bcrypt/bcrypt.js:238:4)
at Module._compile (node:module:736:34)
at Object.Module._extensions..js (node:module:757:11)
at Module.load (node:module:655:32)
HMR Process failed. Restarting on file change...
Version: Deno 1.45.5
When using the
--watch
or--unstable-hmr
flag on a script which uses the bcrypt NPM package, bcrypt fails to import after restart.On first run
After restart due to file change