sharp 包不适用于 canvas nodejs

sharp package doesn't work with canvas nodejs

const { createCanvas, loadImage } = require('canvas')
const sharp = require("sharp");

这是我的代码。

  throw new Error(help.join('\n'));
  ^

Error:
Something went wrong installing the "sharp" module

The specified procedure could not be found.
\?\C:\Users\Thaddea\Documents\ZLI\EDITS\js\fumo\node_modules\sharp\build\Release\sharp-win32-x64.node

Possible solutions:
- Install with the --verbose flag and look for errors: "npm install --ignore-scripts=false --verbose sharp"
- Install for the current runtime: "npm install --platform=win32 --arch=x64 sharp"
- Consult the installation documentation: https://sharp.pixelplumbing.com/install
    at Object.<anonymous> (C:\Users\Thaddea\Documents\ZLI\EDITS\js\fumo\node_modules\[4msharp[24m\lib\sharp.js:30:9)
[90m    at Module._compile (node:internal/modules/cjs/loader:1101:14)[39m
[90m    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)[39m
[90m    at Module.load (node:internal/modules/cjs/loader:981:32)[39m
[90m    at Function.Module._load (node:internal/modules/cjs/loader:822:12)[39m
[90m    at Module.require (node:internal/modules/cjs/loader:1005:19)[39m
[90m    at require (node:internal/modules/cjs/helpers:102:18)[39m
    at Object.<anonymous> (C:\Users\Thaddea\Documents\ZLI\EDITS\js\fumo\node_modules\[4msharp[24m\lib\constructor.js:8:1)
[90m    at Module._compile (node:internal/modules/cjs/loader:1101:14)[39m
[90m    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)[39m

我遇到的错误。

我试过了:

npm install --ignore-scripts=false --verbose sharp

npm install --platform=win32 --arch=x64 sharp

重新安装 sharp,通过 npm rebuild sharp --update-binary 重建 sharp,重新安装 canvas,通过 npm rebuild canvas --update-binary[=13= 重建 canvas ]

有什么帮助吗?

在 Windows 上,您不能同时使用 sharp 和 canvas,并且没有解决方法。

检查这个 --> https://github.com/lovell/sharp/issues/3007