Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

398
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda