Node.js/Node-pre-gyp

来自康健生活
Kangkk​(留言 | 贡献)2024年9月6日 (五) 15:49的版本 (→安装)
(差异) ←上一版本 | 最后版本 (差异) | 下一版本→ (差异)

安装

/home/kangkk
npm install -g node-gyp

在安装 canvas-editor 时遇到异常

[jian@kang /home/kangkk]$
yarn add @hufe921/canvas-editor
Insert comment here
...
Command: node-pre-gyp install --fallback-to-build --update-binary
Arguments:
Directory: C:\\kwy\\GITEA\\athena-frontend\\node_modules\\canvas
Output:
...

查找一些攻略后无果,后发现一个解决办法

/home/kangkk
yarn add canvas --canvas_binary_host_mirror=https://registry.npmmirror.com/-/binary/canvas

之后再安装就可以了。

但这不是好的解题思路。正确的方法应该是从源码开始构建它。参考 https://github.com/Automattic/node-canvas/wiki/Installation%3A-Windows。