Issue: error occurred when building langgraph as the browser target using webpack #172

Closed
opened 2026-02-15 17:16:44 -05:00 by yindo · 2 comments
Owner

Originally created by @Aarebecca on GitHub (Feb 17, 2025).

I attempted to develop an application running on the browser side based on langgraph.js. However, node:async_hooks was used in langgraphjs/libs/langgraph/src/setup/async_local_storage.ts:

https://github.com/langchain-ai/langgraphjs/blob/9f28e437ebeda3653f67b2eeb4e8f085f8295598/libs/langgraph/src/setup/async_local_storage.ts#L2

Which causing an error during webpack building. The prompt was:

ERROR in node:async_hooks
Module build failed: UnhandledSchemeError: Reading from "node:async_hooks" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.

Perhaps it's possible to consider changing node:async_hooks to async_hooks.

import { AsyncLocalStorage } from "async_hooks";

In this way, I can configure webpack to alias async_hooks to a local implementation to bypass the issue.

My webpack version is: 5.97.1

Originally created by @Aarebecca on GitHub (Feb 17, 2025). I attempted to develop an application running on the browser side based on langgraph.js. However, `node:async_hooks` was used in `langgraphjs/libs/langgraph/src/setup/async_local_storage.ts`: https://github.com/langchain-ai/langgraphjs/blob/9f28e437ebeda3653f67b2eeb4e8f085f8295598/libs/langgraph/src/setup/async_local_storage.ts#L2 Which causing an error during webpack building. The prompt was: ```bash ERROR in node:async_hooks Module build failed: UnhandledSchemeError: Reading from "node:async_hooks" is not handled by plugins (Unhandled scheme). Webpack supports "data:" and "file:" URIs by default. You may need an additional plugin to handle "node:" URIs. ``` Perhaps it's possible to consider changing `node:async_hooks` to `async_hooks`. ```ts import { AsyncLocalStorage } from "async_hooks"; ``` In this way, I can configure webpack to alias async_hooks to a local implementation to bypass the issue. My webpack version is: `5.97.1`
yindo closed this issue 2026-02-15 17:16:44 -05:00
Author
Owner

@HonmaMeikodesu commented on GitHub (Mar 1, 2025):

I am not sure but maybe this doc can help?

@HonmaMeikodesu commented on GitHub (Mar 1, 2025): I am not sure but maybe this [doc](https://langchain-ai.github.io/langgraphjs/how-tos/use-in-web-environments/) can help?
Author
Owner

@dqbd commented on GitHub (May 19, 2025):

Hello! @HonmaMeikodesu is right, If you need to use LangGraph on the web, consider importing from @langchain/langgraph/web instead.

https://langchain-ai.github.io/langgraphjs/how-tos/use-in-web-environments/

@dqbd commented on GitHub (May 19, 2025): Hello! @HonmaMeikodesu is right, If you need to use LangGraph on the web, consider importing from `@langchain/langgraph/web` instead. https://langchain-ai.github.io/langgraphjs/how-tos/use-in-web-environments/
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#172