marcwan / LearningNodeJS

Source code to accompany my book, "Learning Node.JS"
280 stars 245 forks source link

getting error in LearningNodeJS/Chapter03/04_async_good.js #30

Closed awwwd closed 7 years ago

awwwd commented 7 years ago

fs.js:688 binding.read(fd, buffer, offset, length, position, req); ^

TypeError: fd must be a file descriptor at TypeError (native) at Object.fs.read (fs.js:688:11) at /home/amitauddy/Working/NodeLiveLessons/async.js:5:12 at FSReqWrap.oncomplete (fs.js:123:15)

Node v6.10.1

marcwan commented 7 years ago

Hi!

This is almost certainly because you didn't run the script in the same folder as the "info.txt" file.

For example, if you do this:

node Chapter03/04_async_good.js

You'll see exactly the same error.

If you actually change into the Chapter03 folder and then run the command:

cd Chapter03
node 04_async_good.js

Then it should work fine.

Lemme know if that helps!