Node.js v17.9.0 [Done] exited with code=1 in 0.641 seconds [Running] node "/Users/ahmadnasser/Desktop/hhjj.js" node:internal/fs/utils:345 throw err; Error: ENXIO: no such device or address, open '/dev/tty' at Object.openSync (node:fs:586:3) at prompt (/Users/ahmadnasser/node_modules/prompt-sync/index.js:67:10) at Object. (/Users/ahmadnasser/Desktop/hhjj.js:22:9) at Module._compile (node:internal/modules/cjs/loader:1099:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:975:32)

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
100%
Error: ENXIO: no such device or address, open '/dev/tty'

I have another problem when I run the code in "js"

const prompt = require("prompt-sync")();
// checking whether it is prime or not
function isPrime(n){
if(n <=1)
console.log("False");
varc = 2;
varbool = true;
while(c*c <= n){
if(n % c === 0){
bool = false;
break;
}
c++;
}
// displaying reuslt
if(bool === false)
console.log("False");
else
console.log("True");
}
// entering number
var n = prompt("Enter a positive number:");
isPrime(n);
Js hjj.js
E Settings
{} settings.json
Users > ahmadnasser > Desktop > Js hhjj.js > ..
1
const prompt = require("prompt-sync")();
checking whether it is prime or not
2
functionieDrimalns
PROBLEMS
OUTPUT
DEBUG CONSOLE
TERMINAL
Code
Node.js v17.9.0
[Done] exited with code=1 in 0.641 seconds
[Running] node "/Users/ahmadnasser/Desktop/hhjj.js"
node:internal/fs/utils:345
throw err;
Error: ENXIO: no such device or address, open '/dev/tty'
at Object.opensync (node:fs:586:3)
at prompt (/Users/ahmadnasser/node_modules/prompt-sync/index.js:67:10)
at Object.<anonymous> (/Users/ahmadnasser/Desktop/hhjj.js:22:9)
at Module._compile (node:internal/modules/cjs/loader:1099:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:975:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
at node:internal/main/run_main_module:17:47 {
errno: -6,
syscall: 'open',
code: 'EΝΧΙ ',
path: '/dev/tty'
}
Node.js v17.9.0
Transcribed Image Text:Js hjj.js E Settings {} settings.json Users > ahmadnasser > Desktop > Js hhjj.js > .. 1 const prompt = require("prompt-sync")(); checking whether it is prime or not 2 functionieDrimalns PROBLEMS OUTPUT DEBUG CONSOLE TERMINAL Code Node.js v17.9.0 [Done] exited with code=1 in 0.641 seconds [Running] node "/Users/ahmadnasser/Desktop/hhjj.js" node:internal/fs/utils:345 throw err; Error: ENXIO: no such device or address, open '/dev/tty' at Object.opensync (node:fs:586:3) at prompt (/Users/ahmadnasser/node_modules/prompt-sync/index.js:67:10) at Object.<anonymous> (/Users/ahmadnasser/Desktop/hhjj.js:22:9) at Module._compile (node:internal/modules/cjs/loader:1099:14) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:975:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12) at node:internal/main/run_main_module:17:47 { errno: -6, syscall: 'open', code: 'EΝΧΙ ', path: '/dev/tty' } Node.js v17.9.0
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY