Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

294
Views
¿Por qué no funciona la búsqueda de nodos (node-fetch) en javascript?

Estoy tratando de obtener datos de una URL con fetch pero no funciona. Importé el módulo de búsqueda de nodos escribiendo:

 const fetch = require("node-fetch");

Y aquí es donde lo uso:

 async function getUrl(url) { let d = await fetch(url); let j = d.json(); return j; } getUrl(myURL);

También tengo el 'npm install node-fetch' en la terminal y dice que no existe tal archivo o directorio.

¿Sabes dónde estoy teniendo el problema?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Una vez que se importa la fetch , esto funciona (en los navegadores, la fetch está integrada):

 async function getUrl(url) { let d = await fetch(url); let j = await d.json(); return j; } // example JSON API const myURL = 'https://reqres.in/api/users'; // IIFE needed for demonstration purposes (async function(){ const data = await getUrl(myURL); console.log(data); })()

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!