linux - ld: 找不到 -lX11 或 -lpng

标签 linux npm ld

运行 npm install face-recognition 在我的 mac 上运行良好,但是当我尝试在我的 Debian VM 上执行此操作时,它失败并出现以下错误:

  SOLINK_MODULE(target) Release/obj.target/facerec.node
/usr/bin/ld: cannot find -lX11
/usr/bin/ld: cannot find -lpng
collect2: error: ld returned 1 exit status
facerec.target.mk:157: recipe for target 'Release/obj.target/facerec.node' failed
make: *** [Release/obj.target/facerec.node] Error 1
make: Leaving directory '/home/ben/face-rec/node_modules/face-recognition/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Linux 4.9.0-6-amd64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/ben/face-rec/node_modules/face-recognition
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok 
npm WARN face-rec@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! face-recognition@0.9.3 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the face-recognition@0.9.3 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ben/.npm/_logs/2018-07-15T19_28_00_238Z-debug.log

我认为关键部分是第 2 行和第 3 行,关于 ld 无法找到 -lX11-lpng 的部分。这在 Mac 上通过安装 Xquartz 很容易解决,但在 Linux 服务器上似乎不可能有解决方法。有什么想法吗?

最佳答案

您只是缺少库。试试这个:

apt-get install libpng-dev libx11

关于linux - ld: 找不到 -lX11 或 -lpng,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51353240/

相关文章:

linux - 在 NodeJS 进程中创建 bash 包装器

linux - Bash 从包含空格的路径中删除文件

linux - 屏蔽 DMA 分配内存的物理地址是否有效?

javascript - 在 webpack 的上下文中导入模块实际上做了什么?

npm - gulp-sourcemaps的用途是什么?

c - 关于重复符号的奇怪 ld 错误

linux - 如何使用 Ansible 添加 PPA 存储库?

node.js - 没有安装 npm 的 Nodejs?

c++ - crtbegin.o、crtbeginT.o 和 crtbeginS.o 之间有什么区别?

c++ - g++/clang++ 中带有 makefile 的参数顺序