const { createCanvas, loadImage } = require('canvas')
const sharp = require("sharp");
This is my code.
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
The error I'm getting.
I tried:
npm install --ignore-scripts=false --verbose sharp
npm install --platform=win32 --arch=x64 sharp
Reinstalling sharp, rebuilding sharp via npm rebuild sharp --update-binary, reinstalling canvas, rebuilding canvas via npm rebuild canvas --update-binary
Any help?
On Windows, you cannot use both sharp and canvas and there is no workaround.
check this --> https://github.com/lovell/sharp/issues/3007
This Github Issue provides a better historical issue analysis. https://github.com/Automattic/node-canvas/issues/930
TLDR;
As per the thread and recent events on the thread, This is still an issue on Windows. But a hack is to try
if (process.platform === 'win32') {
require('canvas');
require('sharp');
} else {
require('sharp');
require('canvas');
}
not sure if this works.