Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

843
Vistas
Strange next.js error in production: ENOENT: No such file or directory (image cache)

I'm having issues with my next.js deployment on AWS EC2. I npm run build and then npm run start, and it works fine. At that point, there are no webp images in the cache, as expected. Then I load the webpage from my browser ,and it works fine. However it randomly seems to crash when i load the page sometimes. And i get the error above. It seems like the webp image is being deleted from the cache at some point, and causing an error? Any suggestions?

The full error is:

Error: ENOENT: no such file or directory, open '/home/ec2-user/prowash/pro-wash-site/.next/cache/images/7P-NdCEO6XWRTvqPItIV6CN1db-7IkBJw9kp3M5VafQ=/0.1647390677641.UEF7UxgKHha+us8b5ahYFWZH70qZHTAu2uyVPlYT7Hs=.webp'
Emitted 'error' event on ReadStream instance at:
    at emitErrorNT (node:internal/streams/destroy:164:8)
    at emitErrorCloseNT (node:internal/streams/destroy:129:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/home/ec2-user/prowash/pro-wash-site/.next/cache/images/7P-NdCEO6XWRTvqPItIV6CN1db-7IkBJw9kp3M5VafQ=/0.1647390677641.UEF7UxgKHha+us8b5ahYFWZH70qZHTAu2uyVPlYT7Hs=.webp'
}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Perhaps use a build script to set the permissions and then implement the next build.

Modifying the solution for EBS via this article:

  1. A Build.sh script that sets permissions before its deployed
#!/bin/bash

# Exit immediately if a command exits with a non-zero status
set -e


# building the Next.js application
npm run next:build

# creating the build/cache/images folder and give it
# the read/write permissions
mkdir -p .next/cache/images
chmod -R 666 .next/cache/images
  1. Addition to package.json to make sure it runs on npm run build
"scripts": {
  "build": "./build.sh"
}
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda