Environment
- Operating System: macOS 25.5.0
- CPU: Apple M1 (8 cores)
- Node.js version: v22.22.3
- nuxt/cli version: 3.35.2
- Package manager: npm 10.9.8
- Nuxt version: 4.4.7
- Nitro version: 2.13.4
- Builder: vite 7.3.5
- Modules: @nuxt/eslint 1.15.2, @nuxt/ui 4.8.2, @nuxt/scripts 1.2.1, @nuxt/image 2.0.0, @nuxtjs/sanity 2.3.0, @nuxtjs/seo 5.1.3, motion-v/nuxt 2.2.1, @vueuse/nuxt 14.3.0, nuxt-schema-org 6.0.4
Reproduction
Any Nuxt 4 project running on Node.js 22 on macOS. Run npm run dev.
Describe the bug
On Node.js 22 + macOS, the dev server is completely broken. every request returns 500. The following error appears on every startup:
ERROR [nuxt] Failed to restrict vite-node socket permissions; closing.
ENOENT: no such file or directory, chmod '/var/folders/.../nuxt-vite-node-xxx/nuxt-vite-node-PID-TIMESTAMP.sock'
at Object.chmodSync (node:fs:2058:11)
at Server.<anonymous> (node_modules/@nuxt/vite-builder/dist/index.mjs:493:8)
at Object.onceWrapper (node:events:633:28)
at Server.emit (node:events:519:28)
at emitListeningNT (node:net:1983:10)
at process.processTicksAndRejections (node:internal/process/task_queues:88:21)
Root cause seems to be: In listenAndRestrict() (@nuxt/vite-builder/dist/index.mjs line ~493), Node.js 22 on macOS fires the listening event on a Unix socket server before the socket file actually appears on disk. The subsequent fs.chmodSync(socketPath, 384) fails with ENOENT, which triggers server.close() in the catch block — permanently destroying the socket server. All requests then fail because NUXT_VITE_NODE_OPTIONS still points to the now-deleted socket path.
Additional context
The sequence:
✔ Vite server built
ERROR Failed to restrict vite-node socket permissions ← socket file not on disk yet
✔ Nuxt Nitro server built
→ Every GET / returns 500
Workaround that fixes the issue.guard the chmodSync call:
// node_modules/@nuxt/vite-builder/dist/index.mjs ~line 493
// Before:
fs.chmodSync(socketPath, 384);
// After:
if (fs.existsSync(socketPath)) { return; }
fs.chmodSync(socketPath, 384);
Logs
Environment
Reproduction
Any Nuxt 4 project running on Node.js 22 on macOS. Run npm run dev.
Describe the bug
On Node.js 22 + macOS, the dev server is completely broken. every request returns 500. The following error appears on every startup:
Root cause seems to be: In listenAndRestrict() (@nuxt/vite-builder/dist/index.mjs line ~493), Node.js 22 on macOS fires the listening event on a Unix socket server before the socket file actually appears on disk. The subsequent fs.chmodSync(socketPath, 384) fails with ENOENT, which triggers server.close() in the catch block — permanently destroying the socket server. All requests then fail because NUXT_VITE_NODE_OPTIONS still points to the now-deleted socket path.
Additional context
The sequence:
✔ Vite server built
ERROR Failed to restrict vite-node socket permissions ← socket file not on disk yet
✔ Nuxt Nitro server built
→ Every GET / returns 500
Workaround that fixes the issue.guard the chmodSync call:
Logs