Automattic / node-canvas

Node canvas is a Cairo backed Canvas implementation for NodeJS.
10.13k stars 1.17k forks source link

The specified procedure could not be found. #2330

Open Dev-ingame opened 9 months ago

Dev-ingame commented 9 months ago

Issue or Feature

node:internal/modules/cjs/loader:1327 return process.dlopen(module, path.toNamespacedPath(filename)); ^

Error: The specified procedure could not be found. \?\C:\Users\ADMIN\Documents\ict\fb\node_modules\canvas\build\Release\canvas.node at Module._extensions..node (node:internal/modules/cjs/loader:1327:18) at Module.load (node:internal/modules/cjs/loader:1091:32) at Module._load (node:internal/modules/cjs/loader:938:12) at Module.require (node:internal/modules/cjs/loader:1115:19) at require (node:internal/modules/helpers:130:18) at Object. (C:\Users\ADMIN\Documents\ict\fb\node_modules\canvas\lib\bindings.js:3:18) at Module._compile (node:internal/modules/cjs/loader:1241:14) at Module._extensions..js (node:internal/modules/cjs/loader:1295:10) at Module.load (node:internal/modules/cjs/loader:1091:32) at Module._load (node:internal/modules/cjs/loader:938:12) at Module.require (node:internal/modules/cjs/loader:1115:19) at require (node:internal/modules/helpers:130:18) at Object. (C:\Users\ADMIN\Documents\ict\fb\node_modules\canvas\lib\canvas.js:9:18) at Module._compile (node:internal/modules/cjs/loader:1241:14) at Module._extensions..js (node:internal/modules/cjs/loader:1295:10) at Module.load (node:internal/modules/cjs/loader:1091:32) at Module._load (node:internal/modules/cjs/loader:938:12) at Module.require (node:internal/modules/cjs/loader:1115:19) at require (node:internal/modules/helpers:130:18) at Object. (C:\Users\ADMIN\Documents\ict\fb\node_modules\canvas\index.js:1:16) at Module._compile (node:internal/modules/cjs/loader:1241:14) at Module._extensions..js (node:internal/modules/cjs/loader:1295:10) at Module.load (node:internal/modules/cjs/loader:1091:32) at Module._load (node:internal/modules/cjs/loader:938:12) at Module.require (node:internal/modules/cjs/loader:1115:19) at require (node:internal/modules/helpers:130:18) at C:\Users\ADMIN\Documents\ict\fb\commands\id.js:14:41 at CommandBuilder.handleChatMessage (C:\Users\ADMIN\Documents\ict\fb\modules\commandbuilder.js:36:25) { code: 'ERR_DLOPEN_FAILED' }

Steps to Reproduce

    var Canvas = require('canvas');

Your Environment

jieLi086 commented 8 months ago

+1

jieLi086 commented 8 months ago

node:internal/modules/cjs/loader:1473 return process.dlopen(module, path.toNamespacedPath(filename)); ^

Error: The specified module could not be found. \?\C:\Users\xxx\node_modules\canvas\build\Release\canvas.node at Module._extensions..node (node:internal/modules/cjs/loader:1473:18) at Module.load (node:internal/modules/cjs/loader:1207:32) at Module._load (node:internal/modules/cjs/loader:1023:12) at Module.require (node:internal/modules/cjs/loader:1235:19) at require (node:internal/modules/helpers:176:18) at Object. (C:\Users\xxx\node_modules\canvas\lib\bindings.js:3:18) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) at Module._load (node:internal/modules/cjs/loader:1023:12) at Module.require (node:internal/modules/cjs/loader:1235:19) at require (node:internal/modules/helpers:176:18) at Object. (C:\Users\xxx\node_modules\canvas\lib\canvas.js:9:18) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) { code: 'ERR_DLOPEN_FAILED' }

Node.js v20.11.0

officefish commented 6 months ago

⨯ Error: The specified procedure could not be found. \?\D:\nest\preview-master\node_modules\canvas\build\Release\canvas.node at Object.Module._extensions..node (node:internal/modules/cjs/loader:1473:18) at Module.load (node:internal/modules/cjs/loader:1207:32) at Function.Module._load (node:internal/modules/cjs/loader:1023:12) at Module.call (node:internal/modules/cjs/loader:1235:19) at Module.mod.require (D:\nest\preview-master\node_modules\next\src\server\require-hook.ts:70:26) at require (node:internal/modules/helpers:176:18) at Object. (D:\nest\preview-master\node_modules\canvas\lib\bindings.js:3:18) at Module._compile (node:internal/modules/cjs/loader:1376:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1435:10) at Module.load (node:internal/modules/cjs/loader:1207:32) at Function.Module._load (node:internal/modules/cjs/loader:1023:12) at Module.call (node:internal/modules/cjs/loader:1235:19) at Module.mod.require (D:\nest\preview-master\node_modules\next\src\server\require-hook.ts:70:26) at require (node:internal/modules/helpers:176:18) at Object. (D:\nest\preview-master\node_modules\canvas\lib\canvas.js:9:18) { code: 'ERR_DLOPEN_FAILED',

mn4367 commented 6 months ago

Is anybody of you all using canvas together with the module sharp?

officefish commented 6 months ago

Is anybody of you all using canvas together with the module sharp?

I am. Moreover I also use nestjs and sharp was imported with nest-sharp so in my way the solution was importing canvas before I initializing main nestjs app. Bese rule is to import canvas before sharp.

nihirv commented 4 months ago

Is anybody of you all using canvas together with the module sharp?

I am. Moreover I also use nestjs and sharp was imported with nest-sharp so in my way the solution was importing canvas before I initializing main nestjs app. Bese rule is to import canvas before sharp.

Tried this.. doesn't seem to work for me

Pickles-wave commented 4 months ago

I'm running into this issue as well,i got a solution. Maybe you guys can try.

If you're an x86 program, this issue may occur, and if you look at canvas.node with Dependencies, you'll see that it may be missing freetype6.dll and intl.dll, in fact, this comes from the GTK, but when you compile the 32-bit canvas, the library name it copies is libfreetype-6.dll and libintl-8.dll, which is the name of the 64-bit compilation from C:\GTK\bin, and the copy fails here, but it is just a warning, and if you look at the full log of npm install, you will see this warning.

To put it simply, copying all the .dlls in C:\GTK\bin into node_modules\canvas\build\Release seems to be a workaround.

zbjornson commented 3 months ago

There's an incompatibility with sharp mentioned in the troubleshooting guide:

I get a the specified procedure could not be found error

If you have Sharp.js also installed, there's an incompatibility between their build of Cairo and our build of Cairo. See #930.

Is anyone not using sharp?