Skip to content

Windows (next-swc.node): Use MSVC's link.exe rather than clang's lld.exe generating next-swc.node to avoid dynamic link issue. #86036

@emmettlu

Description

@emmettlu

Solution: Use MSVC's link.exe to generate next-swc.node binary. Never use clang's toolchain on Windows.

https://github.com/aaravlu/play_nextjs

I find out you just use clang's lld.exe to generate the final next-swc.node binary:

Note the linker version -- 14.0, the binary was linked by clang's lld.exe rather than MSVC's link.exe
Image

~\Repos\play_nextjs> pnpm dev

> play_nextjs@0.1.0 dev C:\Users\Administrator\Repos\play_nextjs
> next dev

 ⚠ Attempted to load @next/swc-win32-x64-msvc, but an error occurred: A dynamic link library (DLL) initialization routine failed
.
\\?\C:\Users\Administrator\Repos\play_nextjs\node_modules\.pnpm\@next+swc-win32-x64-msvc@16.0.1\node_modules\@next\swc-win32-x64
-msvc\next-swc.win32-x64-msvc.node
   ▲ Next.js 16.0.1 (Turbopack)
   - Local:        http://localhost:3000
   - Network:      http://192.168.122.242:3000

 ✓ Starting...
   Skipping creating a lockfile at C:\Users\Administrator\Repos\play_nextjs\.next\dev\lock because we're using WASM bindings
Error: `turbo.createProject` is not supported by the wasm bindings.
    at ignore-listed frames
 ⚠ Attempted to load @next/swc-win32-x64-msvc, but an error occurred: A dynamic link library (DLL) initialization routine failed
.
\\?\C:\Users\Administrator\Repos\play_nextjs\node_modules\.pnpm\@next+swc-win32-x64-msvc@16.0.1\node_modules\@next\swc-win32-x64
-msvc\next-swc.win32-x64-msvc.node

 ELIFECYCLE  Command failed with exit code 3221225477.
~\Repos\play_nextjs> node -p "process.arch"
x64

Provide environment information

Solution: Use MSVC's `link.exe` rather than clang's `lld.exe` generating `next-swc.node` to avoid dynamic link issue.

Which area(s) are affected? (Select all that apply)

SWC

Which stage(s) are affected? (Select all that apply)

next dev (local)

Metadata

Metadata

Assignees

No one assigned

    Labels

    SWCRelated to minification/transpilation in Next.js.locked

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions