MINGW-packages: nodejs: Unable to run Next.js apps
Description / Steps to reproduce the issue
Hi! I am using the mingw-w64-nodejs package for Node.js development. Unfortunately, I can’t run the development servers for my Next.js apps. I believe this is a bug because the apps run fine when I use my system’s Node.js, but they don’t run when I use the MSYS2 version. For both versions, node --version
returns v18.16.1.
Here are some steps to recreate the issue I am experiencing:
- Create a Next.js app by running this command:
npx create-next-app@latest next-app
- Press <kbd>Enter</kbd> several times to install
create-next-app
and select the default options - Change into the directory:
cd next-app
- Run the development server:
npm run dev
(You can then run npm uninstall -g create-next-app
to uninstall the create-next-app
tool.)
Expected behavior
I expected the command npm run dev
to run the development server at http://localhost:3000
and produce output similar to that produced by my system’s Node.js.
The output should look something like this:
> next-app@0.1.0 dev
> next dev
- ready started server on 0.0.0.0:3000, url: http://localhost:3000
- event compiled client and server successfully in 671 ms (20 modules)
- wait compiling...
- event compiled client and server successfully in 375 ms (20 modules)
- wait compiling /page (client and server)...
- event compiled client and server successfully in 16.7s (486 modules)
Actual behavior
Running npm run dev
produces the following output:
> next-app@0.1.0 dev
> next dev
- ready started server on 0.0.0.0:3000, url: http://localhost:3000
thread '<unnamed>' panicked at 'Must load N-API bindings', C:\Users\runneradmin\.cargo\registry\src\
index.crates.io-6f17d22bba15001f\napi-sys-2.2.3\src\functions.rs:7:3
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
The server does not run.
Verification
- I have verified that my MSYS2 is up-to-date before submitting the report (see https://www.msys2.org/docs/updating/)
Windows Version
MINGW64_NT-10.0-19045
MINGW environments affected
- MINGW64
- MINGW32
- UCRT64
- CLANG64
- CLANG32
- CLANGARM64
Are you willing to submit a PR?
I would love to contribute, but I don’t know how to fix the issue.
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 19 (13 by maintainers)
@gnpivo i think we need to compile nextjs from source… do you know what are the steps?
if we use npx, it will download the prebuilt node module of
swc.win32-x64-msvc.node
and try to use it, which is not compatible for mingw env…so, imo, either you ask them to provide
swc.win32-x64-gnu.node
or you must compile your own