node-canvas 非联网情况下的安装问题
发布于 4 年前 作者 FanTaSyLin 3372 次浏览 来自 问答

首先已经安装了 cario pixman等依赖环境

然后将canvas包 拷到node modules 目录下 调用的时候报错 cannot open shared object file: No such file or directory


README上没有说明如何通过源包编译安装canvas 。但是提到了 node-gyp build的方式。

以下是node-gyp configure时出现的问题

[root@mips-sg canvas]# node-gyp configure
gyp info it worked if it ends with ok
gyp info using node-gyp@3.3.1
gyp info using node@4.4.5 | linux | x64
gyp http GET
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: This is most likely not a problem with node-gyp or the package itself and
gyp ERR! stack is related to network connectivity. In most cases you are behind a proxy or have bad 
gyp ERR! stack network settings.
gyp ERR! stack     at Request.<anonymous> (/MIPSDATA1/MIPS_SERVER/node/lib/node_modules/node-gyp/lib/install.js:193:21)
gyp ERR! stack     at emitOne (events.js:77:13)
gyp ERR! stack     at Request.emit (events.js:169:7)
gyp ERR! stack     at Request.onRequestError (/MIPSDATA1/MIPS_SERVER/node/lib/node_modules/node-gyp/node_modules/request/request.js:831:8)
gyp ERR! stack     at emitOne (events.js:77:13)
gyp ERR! stack     at ClientRequest.emit (events.js:169:7)
gyp ERR! stack     at TLSSocket.socketErrorListener (_http_client.js:267:9)
gyp ERR! stack     at emitOne (events.js:77:13)
gyp ERR! stack     at TLSSocket.emit (events.js:169:7)
gyp ERR! stack     at connectErrorNT (net.js:996:8)
gyp ERR! System Linux 2.6.32-279.el6.x86_64
gyp ERR! command "/MIPSDATA1/MIPS_SERVER/node/bin/node" "/usr/bin/node-gyp" "configure"
gyp ERR! cwd /MIPSDATA1/MIPS_SERVER/mips_snipping/node_modules/canvas
gyp ERR! node -v v4.4.5
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok 

这还是要gyp http GET

是否需要修改 node-gyp/lib/install.js 文件? 望高手指点一二

3 回复


windows 下装 node-canvas 才真的是坑爹