I deployed a smart contract and to interact with that I've written Javascript.

When I use loadScript('requestor.js') in my geth console

I'm getting the following error

enter image description here

Line 236 in my code is

const readline = require('readline');

but when I compile readline usage example code from nodejs its working fine.


const readline = require('readline');

const rl = readline.createInterface({
  input: process.stdin,
  output: process.stdout

rl.question('What do you think of Node.js? ', (answer) => {
  // TODO: Log the answer in a database
  console.log(`Thank you for your valuable feedback: ${answer}`);


I'm new to Javascript. I don't know whether readline is removed from my node version 9.11.2 or geth javascript is not supporting it?

  • About language issues it is better to ask in stackoverflow.com directly. – Ismael May 5 '19 at 20:46
  • Yes i know but when i compile readline example in nodejs console its working fine. But when use the same in my geth web3 console im getting an error. I think its related web3 version or web3 library something like that..... – Satish Ganta May 6 '19 at 7:36
  • OK, I understand now. The problem is that geth use a reduced javascript interpreter so it is possible some features required by readline are not available. – Ismael May 6 '19 at 15:01
  • For example in particular const is not supported by geth's console. – Ismael May 6 '19 at 16:51
  • But i need to take input from user and display some outputs in the console. Is there any option other than readline? – Satish Ganta May 7 '19 at 6:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.