You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I tried to build my nextjs( next": "16.1.6") project with almostnode, I have this error:
-----
FATAL: An unexpected Turbopack error occurred. A panic log has been written to /var/folders/j4/_xyc1l8s48zg40k06x8mnbv80000gn/T/next-panic-111ff986222732d84a9ba0c7330fbe23.log.
To help make Turbopack better, report this error by clicking here.
-----
> Build error occurred
Error [TurbopackInternalError]: NftJsonAsset: cannot handle filepath node:module
Debug info:
- Execution of get_all_written_entrypoints_with_issues_operation failed
- Execution of EntrypointsOperation::new failed
- Execution of all_entrypoints_write_to_disk_operation failed
- Execution of Project::emit_all_output_assets failed
- Execution of emit_assets failed
- Execution of emit failed
- Execution of <NftJsonAsset as Asset>::content failed
- NftJsonAsset: cannot handle filepath node:module
at <unknown> (TurbopackInternalError: NftJsonAsset: cannot handle filepath node:module) {
type: 'TurbopackInternalError',
location: undefined
Unfortunately, next build can't work in almostnode right now. almostnode is designed for next
dev, not next build.
The dev server works because we intercept HTTP requests via a Service Worker and do
lightweight JS transforms (ESM to CJS, CSS Modules, React Refresh). We don't need Turbopack or
SWC at all.
next build is fundamentally different:
Turbopack is a native Rust binary. almostnode executes JavaScript, not compiled Rust.
The build does real compilation: tree-shaking, code splitting, static page generation,
writing output to .next/. All of this requires native tooling.
The node:module error is just the first of hundreds of issues that would come up since the
entire build pipeline assumes a real Node.js environment.
For context, StackBlitz's WebContainers don't support next build either. This is a hard
problem for all browser-based Node.js runtimes.
That said, if you have a specific use case (e.g. previewing a production-like build), I'd be
curious to hear more.
I might have misunderstood the question myself @petrbrzek , but I think @trexguo wasn't really trying to build a Next.js project with almostnode. They were talking about failing to build Next.js project that has almostnode installed in it.
I also encountered this with the Next.js dev server (using webpack + v15 mind you), and it has something to do with just-bash trying to load node modules (node:zlib, node:module, etc) in the browser. Either the shimming of those modules doesn't work, or there's something fishy with the bundling.
Activity
petrbrzek commentedon Feb 15, 2026
Thanks for the kind words and for filing this!
Unfortunately, next build can't work in almostnode right now. almostnode is designed for next
dev, not next build.
The dev server works because we intercept HTTP requests via a Service Worker and do
lightweight JS transforms (ESM to CJS, CSS Modules, React Refresh). We don't need Turbopack or
SWC at all.
next build is fundamentally different:
writing output to .next/. All of this requires native tooling.
entire build pipeline assumes a real Node.js environment.
For context, StackBlitz's WebContainers don't support next build either. This is a hard
problem for all browser-based Node.js runtimes.
That said, if you have a specific use case (e.g. previewing a production-like build), I'd be
curious to hear more.
theAJFM commentedon Feb 16, 2026
I might have misunderstood the question myself @petrbrzek , but I think @trexguo wasn't really trying to build a Next.js project with
almostnode. They were talking about failing to build Next.js project that hasalmostnodeinstalled in it.I also encountered this with the Next.js dev server (using webpack + v15 mind you), and it has something to do with
just-bashtrying to load node modules (node:zlib,node:module, etc) in the browser. Either the shimming of those modules doesn't work, or there's something fishy with the bundling.