axinging / webgpu-node-demo

6 stars 0 forks source link

Running on macOs #1

Open stepancar opened 1 year ago

stepancar commented 1 year ago

Hello @axinging! Thanks for creating this project I wanted to try this project (Apple M1 Pro, macOS 13.3.1)

it fails with error

node ./
(node:39471) UnhandledPromiseRejectionWarning: Error: dlopen(/Users/stepancar/Desktop/projects/webgpu-node/external-node/node_modules/@axinging/webgpu/build/dawn.node, 0x0001): tried: '/Users/stepancar/Desktop/projects/webgpu-node/external-node/node_modules/@axinging/webgpu/build/dawn.node' (not a mach-o file), '/System/Volumes/Preboot/Cryptexes/OS/Users/stepancar/Desktop/projects/webgpu-node/external-node/node_modules/@axinging/webgpu/build/dawn.node' (no such file), '/Users/stepancar/Desktop/projects/webgpu-node/external-node/node_modules/@axinging/webgpu/build/dawn.node' (not a mach-o file)
    at Object.Module._extensions..node (internal/modules/cjs/loader.js:1144:18)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at bindings (/Users/stepancar/Desktop/projects/webgpu-node/external-node/node_modules/@axinging/webgpu/node_modules/bindings/bindings.js:112:48)
    at createNodeGPU (/Users/stepancar/Desktop/projects/webgpu-node/external-node/node_modules/@axinging/webgpu/index.js:6:31)
    at Object.getNodeGPU (/Users/stepancar/Desktop/projects/webgpu-node/external-node/node_modules/@axinging/webgpu/index.js:15:27)
    at main (/Users/stepancar/Desktop/projects/webgpu-node/external-node/dawn.js:118:23)
    at Object.<anonymous> (/Users/stepancar/Desktop/projects/webgpu-node/external-node/dawn.js:122:3)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:39471) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:39471) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Do you have any idea how to run it on macos?

axinging commented 1 year ago

There is a binary after you run npm install: ./node_modules/@axinging/webgpu/build/dawn.node Currently, this file is built on Linux. So that's why you failed to run on MacOS(Windows should also fail).

Currently I didn't try build dawn.node on MacOS. If you want to try it by yourself, you can follow this https://source.chromium.org/chromium/chromium/src/+/main:third_party/dawn/src/dawn/node/README.md to build dawn.node and replace it with ./node_modules/@axinging/webgpu/build/dawn.node