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

397
Vistas
Error Unable to find JSON file in folder, Javascript

Trying to fetch my json file, but apparently the URL is invalid or wrong as per the warning. Tried to console log modelURL and it looks correct. Console.log Output : ./tm-my-image-model/model.json

Full error

Uncaught Error: Request to ./tm-my-image-model/model.json failed 

with status code 404 const URL = ./tm-my-image-model/;

let model, webcam, maxPredictions, happy, sad, angry;
let refresh = true;


    async function init() {
        if (refresh) {
            refresh = false;
            const metadataURL = URL + "metadata.json";
            const modelURL = URL + "model.json";
            
      console.log(modelURL)
}}

File Structure

enter image description here

about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

How are you doing the fetch? (It is not in the code you provided).

In Node.js to work with the file system you need to use the native module fs.

Node.js v18.2.0 documentation File system

about 4 years ago · Juan Pablo Isaza Denunciar

0

This depends where you're calling it from. Currently, the path is relative, and where it's relative to can get quite confusing quite quickly. Note that if you're able to send the path with the page render, that might be good too, since you can then resolve the path from node, and avoid any ajax.

That being said, if possible (since this looks to be node anyway), it would probably be a whole lot easier to use require("x") (or import x from "x" if ESM), or, if you need it to load asynchronously, using the await import("x") syntax.

If you're using server side rendering only, it may be useful to make a network call and fetch the file from your server asynchronously as well.

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