vercel / next.js

The React Framework
https://nextjs.org
MIT License
123.29k stars 26.32k forks source link

NextJS does not work with FreeBSD #66645

Open Munrok opened 1 month ago

Munrok commented 1 month ago

Link to the code that reproduces this issue

https://github.com/vercel/next-learn/tree/main/basics/learn-starter

To Reproduce

I'm trying to run NextJS on FreeBSD. The first problem occurs with the swc-freebsd-x64 package, so I install it manually. After installing swc-freebsd-x64, NextJS does not build and I cannot run dev mode - I do not receive any error message, just nothing happens. My steps:

npx create-next-app@latest nextjs-blog --use-npm --example "https://github.com/vercel/next-learn/tree/main/basics/learn-starter" cd nextjs-blog/ npm run build

> build
> next build

  ▲ Next.js 14.2.3

 ✓ Linting and checking validity of types    
   Creating an optimized production build ...
   Downloading swc package @next/swc-freebsd-x64...
 ⨯ Failed to download swc package from https://registry.npmjs.org/@next/swc-freebsd-x64/-/swc-freebsd-x64-14.2.3.tgz
/usr/home/Munrok/next/nextjs-blog/node_modules/next/dist/lib/download-swc.js:98
                throw new Error(`request failed with status ${res.status}`);
                      ^

Error: request failed with status 404
    at /usr/home/Munrok/next/nextjs-blog/node_modules/next/dist/lib/download-swc.js:98:23
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async extractBinary (/usr/home/Munrok/next/nextjs-blog/node_modules/next/dist/lib/download-swc.js:92:9)
    at async downloadNativeNextSwc (/usr/home/Munrok/next/nextjs-blog/node_modules/next/dist/lib/download-swc.js:153:9)
    at async tryLoadNativeWithFallback (/usr/home/Munrok/next/nextjs-blog/node_modules/next/dist/build/swc/index.js:292:5)
    at async /usr/home/Munrok/next/nextjs-blog/node_modules/next/dist/build/swc/index.js:276:40

Node.js v21.7.3

> Build error occurred
Error: Jest worker encountered 1 child process exceptions, exceeding retry limit
    at ChildProcessWorker.initialize (/usr/home/Munrok/next/nextjs-blog/node_modules/next/dist/compiled/jest-worker/index.js:1:11580)
    at ChildProcessWorker._onExit (/usr/home/Munrok/next/nextjs-blog/node_modules/next/dist/compiled/jest-worker/index.js:1:12545)
    at ChildProcess.emit (node:events:531:35)
    at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
  type: 'WorkerError'
}

npm i @next/swc-freebsd-x64

added 1 package, and audited 22 packages in 4s

3 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities

npm run build

> build
> next build

  ▲ Next.js 14.2.3

 ✓ Linting and checking validity of types    
   Creating an optimized production build ...

The NextJS isn't build

PORT=2137 npm run dev

> dev
> next dev

  ▲ Next.js 14.2.3
  - Local:        http://localhost:2137

 ✓ Starting...

As a result, Nextjs does not run on localhost.

PORT=2137 npm run start

> start
> next start

  ▲ Next.js 14.2.3
  - Local:        http://localhost:2137

 ✓ Starting...
Error: Could not find a production build in the '.next' directory. Try building your app with 'next build' before starting the production server. https://nextjs.org/docs/messages/production-start-no-build-id
    at setupFsCheck (/usr/home/Munrok/next/nextjs-blog/node_modules/next/dist/server/lib/router-utils/filesystem.js:151:19)
    at async initialize (/usr/home/Munrok/next/nextjs-blog/node_modules/next/dist/server/lib/router-server.js:61:23)
    at async Server.<anonymous> (/usr/home/Munrok/next/nextjs-blog/node_modules/next/dist/server/lib/start-server.js:249:36)

The last release of @next/swc-freebsd-x64 for FreeBSD was a year ago.

https://www.npmjs.com/package/@next/swc-freebsd-x64

Is there a solution to this? I see I'm not the only one having problems with Nextjs and FreeBSD.

Current vs. Expected behavior

Building NextJS and run dev mode

Provide environment information

FreeBSD 13.2-RELEASE-p10 amd64

node -v v21.7.3
npm -v 10.8.1
yarn -v 1.22.19
Next.js 14.2.3

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

Not sure, SWC

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

next dev (local), next build (local), next start (local)

Additional context

No response

agus7fauzi commented 3 weeks ago

Its because https://www.npmjs.com/package/@next/swc-freebsd-x64 package is not updated and still stuck in 13.2.4 version