Skip to content

When update to node 22, error: bcrypt_lib.node is not a valid Win32 application. #1055

Open
@Pesya1

Description

I have a node app, using "bcrypt": "^5.1.1",
It worked well, with node 20.17.0,
When I update node to 22.11.0, the app failed:

node:internal/modules/cjs/loader:1715 return process.dlopen(module, path.toNamespacedPath(filename)); ^ Error: \\?\D:\my_app\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node is not a valid Win32 application. \\?\D:\my_app\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node

I tried deleting node_modules and package-lock.json,
and run npm install,
The bcrypt installation fails, returning an error:

npm error node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\my_user\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=D:\my_app\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node --module_name=bcrypt_lib --module_path=D:\my_app\node_modules\bcrypt\lib\binding\napi-v3 --napi_version=9 --node_abi_napi=napi --napi_build_version=3 --node_napi_label=napi-v3' (1) npm error node-pre-gyp ERR! stack at ChildProcess.<anonymous> (D:\my_app\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23) npm error node-pre-gyp ERR! stack at ChildProcess.emit (node:events:518:28) npm error node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1104:16) npm error node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:304:5) npm error node-pre-gyp ERR! System Windows_NT 10.0.22621 npm error node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\my_app\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" npm error node-pre-gyp ERR! cwd D:\my_app\node_modules\bcrypt npm error node-pre-gyp ERR! node -v v22.11.0 npm error node-pre-gyp ERR! node-pre-gyp -v v1.0.11 npm error node-pre-gyp ERR! not ok

It seems that the library ran on 32bit, and was not supported by node 22.
How can the problem be solved?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions