错误:bcrypt_lib.node不是有效的Win32应用程序

问题描述 投票:0回答:1

我在Windows机器上有一个nodejs项目。尝试运行该项目时,此错误出现在涉及bcrypt和win32的地方。

[nodemon] 2.0.2[nodemon]随时重新启动,输入rs[nodemon]看目录:[nodemon]看扩展:js,mjs,json[nodemon]开始node app.js内部/模块/cjs/loader.js:1003返回process.dlopen(module,path.toNamespacedPath(filename));^

Error: \\?\C:\Users\owner\desktop\msci444\no-scraps\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node is not a valid Win32 application.
\\?\C:\Users\owner\desktop\msci444\no-scraps\node_modules\bcrypt\lib\binding\napi-v3\bcrypt_lib.node
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1003:18)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (C:\Users\owner\desktop\msci444\no-scraps\node_modules\bcrypt\bcrypt.js:6:16)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
[nodemon] app crashed - waiting for file changes before starting...

pt

javascript node.js windows bcrypt win32-process
1个回答
0
投票

有不同的解决方法:

  • [npm rebuild bcrypt --build-from-source(如注释中所述),检查要重新编译的节点版本是否与测试/生产版本匹配
  • [npm install node-pre-gyp -g然后是npm rebuild bcrypt --build-from-source
  • 在项目文件夹node_modules(..programs \ server \ node_modules)内的部署服务器上,删除包含npm-bcrypt的文件夹。在部署服务器上,运行npm install bcrypt

希望有人帮您

© www.soinside.com 2019 - 2024. All rights reserved.