I’m working on a Forge app called BOT-AI-PEOPLE-CHILE and have set up all the necessary files (manifest.yml, index.js, index.jsx). However, I keep hitting an error when trying to deploy the app with forge deploy:
Error: Bundling failed: Module not found: Error: Can’t resolve ‘async_hooks’ in ‘/Users/matiasmatthews/BOT-AI-PEOPLE-CHILE/node_modules/@forge/api/out/api’
Environment Details:
Forge CLI Version: 10.11.0
Node.js Version: I’ve tried both Node.js 18 and Node.js 20, but I get the same error with both.
Operating System: macOS Sequoia Version 15.1 (24B83)
Dependencies:
I’m using @forge/api and @forge/ui as recommended in the Forge docs.
I tried forcing an older version of @forge/api (2.6.0), but it didn’t help.
Troubleshooting Steps I’ve Already Tried:
Reinstalled @forge/api with different versions (including 2.6.0).
Deleted and reinstalled all dependencies (node_modules and package-lock.json).
Updated Forge CLI to the latest version (10.11.0).
Tested both Node.js 18 and 20 to make sure the Node version isn’t the issue.
Tried manually adding async_hooks, but that didn’t fix it, so I assume it’s something internal to Forge.
Question:
Is there a known fix or workaround for this async_hooks error? It seems like it could be related to an internal dependency in @forge/api. Any guidance on how to handle this would be really appreciated, as it’s blocking me from moving forward with my app.
Thanks a lot for the help, and if there’s any temporary fix I could try, that’d be great to know!
I started writing a type and default object, which frontend would get from invoking the resolver. I put those into the ./resolvers/index.ts, then imported them into ./frontend/index.tsx. And that meant @forge/resolver was getting imported for the frontend code, which is what tripped the bundling error. The solution was to extract my “DTOs” to a separate file without imports. Both frontend and resolvers can share these now, without extraneous imports.
I’m still getting this error and have tried the solutions that Matt recommended as well as double checked for frontend dependencies pulling in libraries for resolvers.
This error occurs also for all tutorial and example apps that I’ve tried that use forge/api