问题描述
我用node.js编写了一个应用程序,它使用argon2模块对密码进行哈希处理。
在我的本地(Windows)计算机上运行,一切都很好。
在Linux服务器上安装应用程序时,安装模块时出错。但是,一旦我将服务器更新为Node.js v12.18.3,重新安装模块就成功完成了。
不幸的是,当我尝试实际运行该应用程序时,出现以下错误:
Syntax on
有什么办法解决这个问题吗?
我尝试跑步:
>$ node app.js
internal/modules/cjs/loader.js:1187
return process.dlopen(module,path.toNamespacedpath(filename));
^
Error: /usr/lib/x86_64-linux-gnu/libstdc++.so.6: version `CXXABI_1.3.8' not found (required by /home/{CENSORED FOR PRIVACY}/node_modules/argon2/lib/binding/napi-v3/argon2.node)
at Object.Module._extensions..node (internal/modules/cjs/loader.js:1187:18)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/home/{CENSORED FOR PRIVACY}/node_modules/argon2/argon2.js:9:56)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/home/{CENSORED FOR PRIVACY}/models/Users.js:2:16)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
如建议的here,但没有帮助。
解决方法
我在CentOS 7上使用argon2时遇到了同样的问题。
像这样解决:
yum install gmp-devel mpfr-devel libmpc-devel wget
wget https://ftp.gnu.org/gnu/gcc/gcc-8.3.0/gcc-8.3.0.tar.gz
mkdir gcc-8.3.0-build
tar xf gcc-8.3.0.tar.gz
cd gcc-8.3.0-build
../gcc-8.3.0/configure --enable-languages=c,c++ --disable-multilib
make && make install
export LD_LIBRARY_PATH=/usr/local/lib64:${LD_LIBRARY_PATH}
按照建议的here
请注意,就我而言,“ make”和“ make install”命令大约需要2个小时才能完成。我需要它们作为根运行。我认为,每次打开终端以运行节点js应用程序时,都应该导出LD_LIBRARY_PATH,如最后一步所示。