"bun run dev" is not working.

Hi' there. My error log is here.
% bun run dev
$ nuxt dev
Nuxt 3.14.1592 with Nitro 2.11.7
➜ Local: http://localhost:3000/
➜ Network: use --host to expose
✔ Vite client built in 46ms
Assertion failed: (napi_call_function(env, recv, callback, 3, args, &recv) == napi_ok), function fse_dispatch_event, file fsevents.c, line 151.
% bun run dev
$ nuxt dev
Nuxt 3.14.1592 with Nitro 2.11.7
➜ Local: http://localhost:3000/
➜ Network: use --host to expose
✔ Vite client built in 46ms
Assertion failed: (napi_call_function(env, recv, callback, 3, args, &recv) == napi_ok), function fse_dispatch_event, file fsevents.c, line 151.
I thinks this is from something wrong in file watch system. OS is MAC (Sequoia 15.3.2) Nuxt version is 3.14.1592. Bun version is 1.2.5. Is same error in Nuxt 3.16.1 and Bun 1.1.6. Anyone know about fix this error?
5 Replies
kapa.ai
kapa.ai5w ago
Hi @Lovefield. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Based on the error logs you've shared, you're experiencing an issue with file watching when running Nuxt with Bun on macOS Sequoia. This appears to be related to known issues with file system watchers in Nuxt development mode. From the knowledge sources, there are several similar issues reported with Nuxt development servers on macOS: 1. In one case, users reported that HMR (Hot Module Replacement) was extremely slow in Nuxt 3.14.1592, with file changes triggering excessive reloads GitHub Issue #30290. 2. Another user reported "too many open files" errors on macOS Sonoma/Sequoia when running Nuxt with Capacitor GitHub Issue #12376. Here are some potential solutions you can try: 1. Change the file watcher You can try switching to the parcel watcher instead of the default one. Several users reported this fixed similar issues on macOS:
// nuxt.config.ts
export default defineNuxtConfig({
vite: {
server: {
watch: {
usePolling: true
}
}
}
})
// nuxt.config.ts
export default defineNuxtConfig({
vite: {
server: {
watch: {
usePolling: true
}
}
}
})
2. Ignore directories with many files If you have directories with many files that don't need to be watched:
export default defineNuxtConfig({
ignore: [
'**/folder-with-many-files/**'
]
})
export default defineNuxtConfig({
ignore: [
'**/folder-with-many-files/**'
]
})
3. Disable Spotlight indexing One user mentioned that disabling Spotlight indexing for their project directory resolved similar issues on macOS. 4. Clean installation Try removing these directories and reinstalling dependencies: - Delete .nuxt directory - Delete .output directory - Delete node_modules directory - Delete lockfile (package-lock.json, yarn.lock, or pnpm-lock.yaml) - Reinstall dependencies This approach helped some users with similar socket-related errors GitHub Issue #31253. 5. Try a different Node.js version Some users reported success by switching to a different Node.js version. You might want to try Node.js v20 or v23.9. If none of these solutions work, you might want to consider using npm or yarn instead of Bun until this specific issue is resolved in a future update. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai5w ago
<@370382517720580099> Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Lovefield
LovefieldOP5w ago
@kapa.ai It's working! but other problem. In docker container. It's working, but nothing response. no error, no log.
kapa.ai
kapa.ai5w ago
Let me check the knowledge base for you again. One moment! :books: ---------------------- I'm glad to hear that your initial issue is resolved! Now you're facing a new problem with your Nuxt application in a Docker container where it's running but not responding or producing logs. Based on the knowledge sources, this is a common issue when running Nuxt in Docker containers. Here are some potential solutions: 1. Configure Nuxt to accept external connections The most likely issue is that Nuxt is only listening on localhost inside the container. By default, Nuxt only accepts connections from the host machine, which prevents external access from Docker's network:
# In your docker-compose.yml
environment:
HOST: 0.0.0.0
PORT: 3000
# In your docker-compose.yml
environment:
HOST: 0.0.0.0
PORT: 3000
Or in your nuxt.config.js/ts:
server: {
port: 3000,
host: '0.0.0.0' // do not use localhost (only accessible from the host machine)
}
server: {
port: 3000,
host: '0.0.0.0' // do not use localhost (only accessible from the host machine)
}
As mentioned in this Stack Overflow answer, this is a common issue when dockerizing Nuxt applications. 2. Check network configuration in Docker Compose If you're using Docker Compose, ensure your services are on the same network and properly configured:
networks:
nuxt_network:
driver: bridge

services:
nuxt:
# ... other config
networks:
- nuxt_network
networks:
nuxt_network:
driver: bridge

services:
nuxt:
# ... other config
networks:
- nuxt_network
3. Verify your ENTRYPOINT in Dockerfile Make sure your Dockerfile has the correct entrypoint for Nuxt 3:
ENTRYPOINT ["node", ".output/server/index.mjs"]
ENTRYPOINT ["node", ".output/server/index.mjs"]
4. Volume mounting issues If you're using volumes in development mode, they might be overriding your built files. As seen in this Stack Overflow post, volumes can cause the .output directory to be missing:
# For production, either remove volumes or use a separate production config
volumes: []
# For production, either remove volumes or use a separate production config
volumes: []
5. Check for server/client URL mismatches If your application makes API calls, there might be a mismatch between server and client URLs. As shown in this Stack Overflow post, you may need to configure different URLs for server and client contexts:
// Example of handling different URLs for server/client contexts
const strapiBaseUri = process.server ? "<http://strapi:1337/api"> : runtimeConfig.public.strapiBaseUri + '/api';
// Example of handling different URLs for server/client contexts
const strapiBaseUri = process.server ? "<http://strapi:1337/api"> : runtimeConfig.public.strapiBaseUri + '/api';
Debugging steps 1. Try running the container with interactive mode to see any console output:
docker run --rm -it -p 3000:3000 your-nuxt-image

docker run --rm -it -p 3000:3000 your-nuxt-image

2. Check if the container is actually listening on port 3000:
docker exec -it your-container-name netstat -tulpn

docker exec -it your-container-name netstat -tulpn

3. Verify that your environment variables are correctly passed to the container using:
docker exec -it your-container-name env

docker exec -it your-container-name env

If you need more specific help, please share your Dockerfile and docker-compose.yml (if you're using it) so I can provide more targeted assistance. Let me know if any of these solutions work for you! ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai5w ago
<@370382517720580099> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?