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

133
Views
Seemingly device-specific difficulties taking input using readline with Node.js

I'm trying to take input using readline but am running into an unknown error after doing so. To make matters worse, my friend has no difficulties running the exact same piece of code on his device.

const { Octokit } = require("@octokit/rest");
const readline = require("readline");
const util = require('util');

const octokit = new Octokit();
const rl = readline.createInterface(process.stdin, process.stdout);
const question = util.promisify(rl.question).bind(rl);

const getUsername = async () => { return await question("Enter GitHub username: "); }
const getRepoData = async (uname) => { return await octokit.request("/users/" + uname +  "/repos"); }


(async () => {
    try {
        console.log("checkpoint")
        const uname = await getUsername();
        console.log("checkpoint2")
        console.log(uname);
        var repoData = await getRepoData(uname); 
        repoData = repoData["data"]; // is a list of dictionaries, e.g. repoData[0]["name"]
        console.log(repoData);
    } catch (err) {
        console.log("FAILED");
        console.log(err);
    } finally {
        rl.close();
    }
})() 

My intention is that the program prints out information about a given GitHub user. However, running this program in console with node app.js results in

checkpoint
Enter GitHub username: fuzzyhappy
FAILED
fuzzyhappy

I have no idea why it's printing back the response to the question either.

about 4 years ago · Juan Pablo Isaza
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!