"No such file or directory" ... "./build/HavokPhysics.wasm"

I’m getting this error in my server when trying to add Havok to my project:

ENOENT: No such file or directory
   errno: -2
 syscall: "open"
   path: "./build/HavokPhysics.wasm"

And this error in console:

 GET http://localhost:3000/build/HavokPhysics.wasm 500 (Internal Server Error)
getBinaryPromise	@	index.js:410708
instantiateArrayBuffer	@	index.js:410738
(anonymous)	@	index.js:410754
Promise.then (async)		
(anonymous)	@	index.js:410751
Promise.then (async)		
instantiateAsync	@	index.js:410749
createWasm	@	index.js:410770
(anonymous)	@	index.js:411849
startGame	@	index.js:412361
await in startGame (async)		

You can see where I try to add Havok on this branch: Adding Havok by ThomasBurgess2000 · Pull Request #10 · ThomasBurgess2000/boxcar · GitHub

I’m using bun in case that matters

This appears to be a bug with Bun, will switch bundlers. (although I get a different error with vite, will consult other threads that are related to this “magic word” issue).


I was able to resolve the bun issue by manually copying HavokPhysics.wasm to the build folder.