Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

canvas.node is not a valid Win32 application. #2420

Open
aman-sharma24 opened this issue Aug 21, 2024 · 0 comments
Open

canvas.node is not a valid Win32 application. #2420

aman-sharma24 opened this issue Aug 21, 2024 · 0 comments

Comments

@aman-sharma24
Copy link

Issue

I have a node JS application deployed on Azure functions using Azure dev-ops pipeline. Dev-ops pipeline uses ubuntu-latest vmImage. After the deployment when I run my function I get the following error.

Error: \?\C:\home\site\wwwroot\node_modules\canvas\build\Release\canvas.node is not a valid Win32 application. \?\C:\home\site\wwwroot\node_modules\canvas\build\Release\canvas.node at Module._extensions..node (node:internal/modules/cjs/loader:1452:18) at Module.load (node:internal/modules/cjs/loader:1197:32) at Module._load (node:internal/modules/cjs/loader:1013:12) at Module.require (node:internal/modules/cjs/loader:1225:19) at Object.apply (C:\Program Files (x86)\SiteExtensions\Functions\4.34.2\workers\node\dist\src\worker-bundle.js:2:51713) at require (node:internal/modules/helpers:177:18) at Object. (C:\home\site\wwwroot\node_modules\canvas\lib\bindings.js:3:18) at Module._compile (node:internal/modules/cjs/loader:1356:14) at Module._extensions..js (node:internal/modules/cjs/loader:1414:10) at Module.load (node:internal/modules/cjs/loader:1197:32)

Environment

===================================================================
Azure Function Configuration:

image

===================================================================

  • Version of node-canvas - output of npm list canvas :

npm list canvas

+-- [email protected]
-- [email protected] +-- [email protected] deduped -- [email protected]
`-- [email protected] deduped

===================================================================
node version: node -v
v18.19.1

===================================================================
node -p "process.arch"
Output: x64

===================================================================
// saved in a file and then run with node
const fs = require("fs");
const path = require("path");
const cnode = path.join(require.resolve("canvas"), "../build/Release/canvas.node");
const fd = fs.openSync(cnode);
const b = Buffer.alloc(4);
fs.readSync(fd, b, 0, 4, 60);
const pe_addr = b.readUInt32LE(0);
fs.readSync(fd, b, 0, 2, pe_addr + 4);
const type = b.readUInt16LE(0);
console.log(type.toString(16));

Output: 1e

===================================================================
System Info:

OS version: Microsoft Windows NT 10.0.20348.0
64 bit system: True
64 bit process: True
Processor count: 1

===================================================================

Let me know if you need any other information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant