When I run npm run build I get the error of the following screenshot, I have tried to investigate it and reading other topics I see that performing npm cache clean can solve the problem, but in my case this gives again other errors. So I don't know what I can try to fix it. I would appreciate some help, thank you very much.
Edit with the field [url].js
since the error seems to come from this file I share it with you to see what it could be
import Layout from "../../components/Layout"
import Image from "next/image"
import { formatearFecha } from "../../helpers"
import styles from '../../styles/Entrada.module.css'
const EntradaBlog = ({entrada}) => {
const {contenido, imagen, titulo, published_at} = entrada
return (
<Layout pagina={titulo}>
<main className="contenedor">
<h1 className="heading">{titulo}</h1>
<article className={styles.entrada}>
<Image src={imagen.url} alt={`img entrada - ${titulo}`} width={300} height={200} layout='responsive' />
<div className={styles.contenido}>
<small>Publicado el: <span className={styles.fecha_span}>{formatearFecha(published_at)}</span></small>
<p className={styles.texto_contenido}>{contenido}</p>
</div>
</article>
</main>
</Layout>
)
}
export async function getStaticPaths(){
const url = `${process.env.NEXT_PUBLIC_API_URL}/blogs`
const respuesta = await fetch(url)
const entradas = await respuesta.json()
const paths = entradas.map(entrada => ({
params: { url: entrada.url }
}))
return {
paths: paths,
fallback: false
}
}
export async function getStaticProps({params: { url }}){ //se encarga de traer la información que irá en cada página
const urlBlog = `${process.env.NEXT_PUBLIC_API_URL}/blogs?url=${url}`
const respuesta= await fetch(urlBlog)
const entrada = await respuesta.json()
return {
props: {
entrada: entrada[0],
}
}
}
export default EntradaBlog