node.js - Node 应该使用什么环境变量来加载库?

标签 node.js linux path

我在服务器上收到此错误:

Node :加载共享库时出错:libstdc++.so.6:无法打开共享对象文件:没有这样的文件或目录

然而,一个简单的发现显示:

/usr/lib/x86_64-linux-gnu/libstdc++.so.6

我已经在 .bashrc 中设置了以下内容:

export PATH=$PATH:~/.local/bin:/usr/lib
export LD_LIBRARY_PATH=/usr/lib:/usr/local/lib:~/.local/lib
export LIBRARY_PATH=/usr/lib:/usr/local/lib:~/.local/lib

但 Node 找不到现有的 libstd 库。 我已经做到了

source .bashrc 

还有

echo $LIBRARY_PATH

这是我搜索过的一个非常常见的问题,但大多数解决方案都建议安装,在我的情况下,文件已安装 Node 只是看不到它。

最佳答案

尝试通过apt-get install lib32stdc++6安装缺少的lib32stdc++

设置LD_DEBUG以便更好地诊断。
如果设置了 LD_DEBUG 变量,那么 Linux 动态链接器将转储可用于快速解决大多数加载问题的调试信息。要查看可用选项,只需运行将变量设置为 help 的任何程序即可。

LD_DEBUG 环境变量的有效选项是:

  libs        display library search paths
  reloc       display relocation processing
  files       display progress for input file
  symbols     display symbol table processing
  bindings    display information about symbol binding
  versions    display version dependencies
  all         all previous options combined
  statistics  display relocation statistics
  unused      determined unused DSOs
  help        display this help message and exit

关于node.js - Node 应该使用什么环境变量来加载库?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43244995/

相关文章:

windows - 运行具有带空格字符路径的 python 批处理文件

algorithm - 在图中查找特定权重下的所有路径

javascript - 如果两个 promise 同时解决,这是否可能是竞争条件?

Linux - 删除早于 x 天的目录

我可以在 Linux 中使用 winnt.h 吗?

windows - 堆栈增长如何在 Windows 和 Linux 上工作?

css - 将特定类样式添加到路径

javascript - ajax 文件上传问题(Node.js、express、jQuery)

javascript - 如何打印指定 MySQL 表的递归、有序、依赖表的列表

javascript - 在内部 forEach 循环中集成异步 mongo 调用