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

359
Visualizações
axios .then() doesn't run in node.js

so I'm trying to make a terminal app but .then() dosen't do anything at all i tried to make a function that returns the response and it runs but it returns undefined i was also trying to use a libery that let me get hardware info but it was async and it didn't work can anyone help? edit: i forgot to add that the code works when i try running it in another script

full code here: https://pastebin.com/Q4bNu0h0


    while (true) {
        
        a = prompt('esyx> '.red)
        if(a == 'exit'){
            commands.exit.execute()
        }else if(a == 'help'){
            commands.help.execute()
        }else if(a == 'cpu' || a == 'cpuModel'){
            commands.getCpu.execute()
        }else if(a == 'mem' || a == 'totalMemory'){
            commands.totalMemeory.execute()
        }else if(a == 'freemem' || a == 'freeMemory'){
            commands.freeMemeory.execute()
        }else if(a.slice(0, 4) == 'ping'){
            //problem here
            axios.get('https://www.shark-core.com').then(function (response) {
                    console.log(response);
                }).catch(function (error) {
                    console.log(error);
                }).then(function () {
                    //this dosen't run
                    console.log('testing')
                });
            
        }else{
            console.log(('"' + a + '" is not a real command').red)
        }
    }
about 4 years ago · Santiago Gelvez
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