我的 Windows 机器上有一个 nodejs 项目。在尝试运行项目时,出现此错误,涉及 bcrypt 和 win32。
[ Node 监视器] 2.0.2
【nodemon】随时重启,输入rs
[nodemon] 观看目录:.
[nodemon] 看扩展:js,mjs,json
[nodemon] 开始 node app.js
内部/模块/cjs/loader.js:1003
return 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
最佳答案
如何解决有不同的可能性:
npm rebuild bcrypt --build-from-source
(如评论中所述)检查您的用于重新编译的 Node 版本是否与测试/生产版本匹配 npm install node-pre-gyp -g
然后 npm rebuild bcrypt --build-from-source
npm install bcrypt
希望对你有帮助
关于javascript - 错误 : bcrypt_lib. Node 不是有效的 Win32 应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60962219/