Home > database >  No such built-in module "readline/promises"
No such built-in module "readline/promises"

Time:09-15

I'm having problems using readline, every time I get the error No such built-in module: node:readline/promises. However according to Readline's own doc I would only need this part https://nodejs.org/api/readline.html

import * as readline from 'node:readline/promises';
import { stdin as input, stdout as output } from 'node:process';

const rl = readline.createInterface({ input, output });

Image of the package.json

Image of the error

I'm sorry if this is a question that has already been answered before, but I couldn't find anything that would help me.

CodePudding user response:

This may be dependent on which version of node you're running. Different versions have different ways of importing built in modules. If you don't know which version you're on, run node -v on the console, the go to the node readline documentation here, go to Other Versions at the top and select your node version.

  • Related