npm 安装失败,出现 libxmljs 的 node-gyp 错误

npm install fails with node-gyp errors for libxmljs

我正在尝试 运行 使用 libxmljs 的节点项目,但安装失败,

npm "ld: symbol(s) not found for architecture x86_64"

我尝试了不同版本的 npm,但 none 的帮助,所有版本都出现了同样的问题。

我该如何解决这个问题?

对于这个项目,我设法通过在 package.json

中使用较新版本的 libxml 来修复它

我从 v0.11

提高到 v0.18
"dependencies":{
    "libxmljs": "^0.18.0"
}

然后 运行 再 npm install。我不知道这是否重要,但我也删除了我的 ~/.node-gyp 文件夹。请注意,此解决方案是由 a comment on a similar github issue

建议的