By Developers, For Developers

Historical errata for Node.js 8 the Right Way

PDF PgPaper PgTypeDescriptionFixed onComments
29SUGGEST

The installation instruction for node v8 didn’t work for me. I’m on ubuntu 16.04 (linux mint).
I found this page for the solution: (sorry cant post the url, it seems to be not allowed :-( )
This worked for me, as instructed on that page:

  1. Using Ubuntu
    curl -sL (—again url’s are not allowed :( ) | sudo E bash
    sudo apt-get install -y nodejs

detail: i installed this OS only a month ago, with the latest stable packages. However, when i started out with this book, Node was on version 4.
Further more, nvm was not installed. Perhaps this is something to add to the instructions.

Kind regards
Michael (michaelsperber01@gmail.com)

2017-10-11Are you working from the new Node.js 8 the Right Way book? or is this feedback based on the first edition? The new edition shows you how to install Node.js with nvm.
9TYPO

Paragraph 5, only sentence - missing word “like”:

Modern JavaScriptisms discussed in this book include things ^ arrow functions

2017-06-22
13SUGGEST

“Arrow functions are new in ECMAScript version 6”. Starting with the 6th edition of the ECMA-262 spec, releases are named by publication year rather than version number, so such citations should probably all say “ECMAScript 2015” instead of “ECMAScript version 6”.

2017-06-22
34TYPO

and the full path to the watcher-argv.js as its first two elements.
the second arg is the full path to watcher.js
Michael Sperber

2017-06-22
17TYPO

Beyond the code block () => { … } in the sentence starting with Unlike there are missing some i characters => functon expresson

2017-06-22
368TYPO

Command should be:
./esclu url ‘some/path’ -p 8080 -o my.cluster

instead of
./esclu url ‘some/path’ -p 8080 -h my.cluster

2017-06-22
86TYPO

s/sucessfully/successfully/

Also, on page 175: s/sucess/success/
and on page 216: s/sucessful/successful/

2017-06-27
209ERROR

Code snippet includes case statement for ‘#list-bundles’ which has not been introduced yet, and which calls getBundles which has not been defined yet

2017-06-27
174ERROR

Comment includes curl command for POST, but function is for GET:

/

  • Retrieve a given bundle.
  • curl -X POST …
    */
    app.get(‘/api/bundle/:id’, async (req, res) => {
    …
2017-06-27
213TYPO

s/One we add/Once we add/

2017-06-27
215TYPO

s/as-yet-unwriten/as-yet-unwritten/

2017-06-27
216TYPO

s/with the give name/with the given name/

2017-06-27
217TYPO

s/handle requests as scale/handle requests at scale/

2017-06-27
218TYPO

s/in you Node.js and front-end code/in your Node.js and front-end code/

2017-06-27
132TYPO

The example command $ ./esclu url ‘some/path’ -p 8080 -h my.cluster should be $ ./esclu url ‘some/path’ -p 8080 -o my.cluster, the help flag is -h, the host flag is -o, running the code as is will display the help not the output of the command as expected.

2017-06-27
104SUGGEST

The test:debug line does not work on Cygwin on Windows 10. This alternative does:

“test:debug”: “node —inspect node_modules/mocha/bin/_mocha —watch —no-timeouts”

Also the way to access the Chrome DevTools is now easier - just browse to chrome://inspect and it should find your mocha target.
You may want to update the text to reflect this.

2017-07-22
4532SUGGEST

Running command: “$ nc -U /tmp/watcher.sock” for the second time, gives a Error: “Error: listen EADDRINUSE /tmp/watcher.sock”. A solution is to remove the file: “/tmp/watcher.sock”, before running it again.

2017-07-22
9TYPO

3rd paragraph in first section of Preface: enivornment => environment in
“Second, JavaScript has quietly become the world’s standard code execution enivornment. ”

2017-07-22
7058TYPO

When confirming version of OMQ (node -p -e “require(‘zeromq’).version”) printed results shows version 4.1.6 but install instructions dictated 4.2.1.

2017-07-22
6249TYPO

setTemout should be setTimeout

2017-07-22
6856TYPO

widespread atoption should be widespread adoption

2017-07-22
6856TYPO

shoul must be should

The zeromq module shoul take care of building the necessary underlying libraries.

2017-07-22
7058SUGGEST

Version numbers don’t match exactly:
$ npm install —save —save-exact zeromq@4.2.1
And..
$ node -p -e “require(‘zeromq’).version”
4.1.6

2017-07-22
49TYPO

In last code block:

s/setTemout(done, 4500);/setTimout(done, 4500);/

2017-07-22
124ERROR

As it stands the command ‘$ ./esclu get’ returns nothing as program.json is undefined?

The command ‘$ ./esclu -j get’ sets program.json and prints the expected data, although in a single line, not formatted as shown on the page.

2017-10-11
124SUGGEST

Nope sorry, my previous submisson about page 124 is NOT an error - my bad. Made a mistake with the code around throwing the error. Apologies.

2017-10-11
9786SUGGEST

…create a subdirectory called test…

The sub-directory called ‘test’ for unit testing was already created before chapter “Declaraing (Declaring) Expectations with Chai”.

2017-10-11
9786TYPO

“Declaraing with Chai” should be “Declaring with Chai”

2017-10-11
10392SUGGEST

Why not install “cheerio” as a dev dependency?

“npm install —save —save-exact cheerio@0.22.0”
could be
“npm install —save-dev —save-exact cheerio@0.22.0”

2017-10-11
103SUGGEST

Please ignore #81863. I mixed up cheerio with chai.
Sorry

2017-10-11
145TYPO

In last line of “Deleting an Index” there’s a typo in word ‘issues’:
“Hint: The request.del() issuse a DELETE request.” should be “Hint: The request.del() issues a DELETE request.”

2017-10-11
112TYPO

Obects should be object
The source objects are the book obects returned by parseRDF().

2017-10-11
113TYPO

The last property of object ‘options’ ends with a comma:
exclude: [‘pg0.rdf’],

2017-10-11That was intentional. Trailing commas are allowed in object literals as of EcmaScript 5.
119TYPO

develompent should be development

Acquiring, transforming, storing and querying data are crucial skills in modern software develompent with Node.js.

2017-10-11
151TYPO

conver should be convert

Likewise, if the user provided a filter on the command line with the -f flag, we conver this to a _source parameter for the query string

2017-10-11
165TYPO

es.hostname should be es.host

2017-10-11
11TYPO

On the second line on the PDF page, EventEmitter is hyphenated Even-tEmitter. I think Event-Emitter would be more legible.

2017-10-11
167158ERROR

url constant variable is not correct.
Remove the /book/ part.

So,

//${es.host}:${es.port}/${es.books_index}/book/_search`;

Should be

//${es.host}:${es.port}/${es.books_index}/_search`;

2017-10-11I think leaving the /book/ is correct but may not be required? The /book/ part indicates the type of document that we're searching for.
9483TYPO

Error: The Art of War by Sunzi

The author’s name is Sun Tzu

2017-10-11I've seen it written that way too, you're right that that's the most widely used name in the West. I was going by the name listed on the Project Gutenberg page: http://www.gutenberg.org/ebooks/132 since that would match the catalog data.
219TYPO

Second para in “Deleting Bundles” is “To get started, navigate to the listBundles() function and add this block of code inside the try block.” but there is no try block in listBundles()?

2017-10-11
44TYPO

npm install —save —save-exact mocha@3.4.2

does not include the —save-dev option that is mentioned 2 par’s later, so mocha ends up in std dependencies list.

2017-10-11
230TYPO

At the end of the second last paragraph “… as Sign Out link.” should be “… a Sign Out link.”

2017-10-11
7TYPO

Take the concept of a variable. In algebra it’s common to see equations like
“ 7x + 3 = 24 .” Here, x is called a variable; it has exactly one value, and your job
is to solve the equasion to figure out what that value is.

equasion should be replaced with equation

2017-10-11
43ERROR

On page 43, the test script to run is named “net-watcher-json-test-service.js” but was named “test-json-service.js” on pages 37-38.

2017-10-11
49TYPO

“timeout” is misspelled as “timetout”:

“To set the Mocha timeout for the whole run, use the —timeout flag to specify the timetout in milliseconds.”

2017-10-11
170161TYPO

exract should be extract

Finally, if there were no errors, we exract just the _source objects (the true documents) from the Elasticsearch response, and report these to the caller as JSON.

2017-10-11
2612TYPO

Page 26/12 says to create a file called “file-system/watcher.js” after moving into an empty directory (is this empty directory “file-system” or is the “file-system” directory to be created within the empty directory?). Then, on page 27/13 the user is asked to run “watcher.js” without changing directories. Does “file-system” just need to be removed from the file path?

2017-10-11
2915TYPO

Line: fs.watch(filename, () => console.log(`File ${filename} changed!`));

Has tick marks instead of single quotes.

2017-10-11
2915TYPO

(Ooops — ignore my suggestion for these pages a moment ago, on tick marks. Seems that you can’t edit/delete a suggestion after submitting on this page. Sorry!)

2017-10-11
8371TYPO

In one of the code comments " // Fork three worker processes.“, it says ”three" when the code actually spins up as many worker processes as “const numWorkers = require(‘os’).cpus().length;” returns. The comment is above this line: “for (let i = 0; i < numWorkers; i) {”

2017-10-11
259251TYPO

user.profile should be user.provider

This terse arrow function uses nested destructuring assignment to pull out the user.profile and user.id properties from the Express Request instance passed in.

2017-10-11
171ERROR

It appears that I am having issues with “express”: “4.14.1”and the app.post, create bundle example having url parameters. If I change the app.post to app.get it appears to work fine.

98TYPO

“Here, instead of finding each subject’s living it its own
tag…”

The word “it” should be “in” here.

8TYPO

On “Programming for the Node.js Event Loop”,
Example of command:
$ echo, > target.txt

Expected as:
$ echo > target.txt

2018-02-14Hi sshida, \n \nThe comma after echo in 'echo,' was intentional, I know it looks weird. Putting a punctuation mark after echo in Windows creates a file with a single empty line (or so I understand).
33TYPO

On the last line:
“… and save its text content to the book.text property.”

Should be:
“… nd save its text content to the book.title property.”

2930SUGGEST

In Version 8.9.3 of node and the net library there will be a hard error if you do not use an on(‘error’) clause.
So changing to
connection.on(‘close’, () => {
console.log(‘Subscriber disconnected.’);
watcher.close();
})
.on(‘error’, () => console.log(‘errored’));
does the Job.

Gunnar

BTW: I love this book - finally a book with the right Speed and Informations. Thank you so much for finally getting into node.

78ERROR

Missing code example for “Bidirectional Messaging” within downloadable code.
On page 78 it was mentioned that an example could be find within the downloadable code, but I wasn’t able to find the code.

10087ERROR

The code example doesn’t have closing braces and parenthesis.

18ERROR

As copied from the page, the last line of the code example watcher-spawn-parse.js gives me an error on the extra paren: );
“Unexpected token )”.

fs.watch(filename,() => {constls = spawn(‘ls’, [‘-l’,‘-h’, filename]);letoutput=’‘;ls.stdout.on(’data’, chunk=> output+= chunk);ls.on(‘close’, () => {constparts= output.split(/\\s+/);console.log([parts[0],parts[4],parts[8]]);}); });

I do not know JS, so please forgive me if I mis read the example. I am just learning.
BrentC

2018-02-14In the code pasted here, some spaces are missing. For example 'const ls' shows up as 'constls'. It's common for pasted text from PDFs to omit important whitespace, so you may have better luck by following along with the code downloads that accompany the book. Thanks!
5TYPO

In the last paragraph of the page, second sentence:

Platforms for protyping the Internet of Things…

Should be prototyping I’d think.

74ERROR

On the figure the top heavy arrow should point towards worker processes and not master process

n/an/aTYPO

My dear shattered Fire Kindle has no page numbers, but makes up it’s own ‘Location 2701’. For those intrepid souls that type all the sample code themselves… The first coding pass at databases/test/parse-rdf-test.js missing a second and final bracket-paren-semicolon to close off the first ever ‘describe’ statement for that file. So, parse-rdf-test.js should have }); and then another (which is missing) }); Then your test should fail instead of throwing a compile error. Do programs still compile? Oh heck, you know what I mean.

50SUGGEST

In Testability, the first question is asking to add a test that split message over two (or more) data events from the stream. However, that’s exactly the test that was already added on p. 48.

102TYPO

Comment in the source file

// Match file names that in ‘.rdf’.

should probably read

// Match file names that END in ‘.rdf’.

130ERROR

In the code to do a bulk index you pass in the type arg on the command line but do not use it. Full URL should be: url: fullUrl(`${program.type}/_bulk`),
else you’ll get errors

98TYPO

In the first paragraph, second line, it says:

… with the CSS selector [rdf\\:resource$=“LCSH”] . …

==> there is a missing “\\”, just as you can see in the code of parse-rdf.js, just above that paragraph:

Note the double backslash between “rdf” and “:” => [rdf\\\\:resource$=“LCSH”]

128SUGGEST

You are explaining jq function ‘keys’ again here - you already explained what it does on the previous page.

195TYPO

the html on first line ‘fade in’ should be ‘fade-in’.

239SUGGEST

Seems like when Authenticating with Facebook, http is not allowed. its suggests to try via https.

34ERROR

The correct command is “$ nc -U /tmp/watcher.sock” not “$ nc localhost 60300”.

178ERROR

In the code example at the bottom of the page the await keyword is missing in front of the function calls. Currently, the API response is not awaiting the Elasticsearch responses.

87ERROR

Missing parentheses }); at the end of parse-rdf-test.js.

32ERROR

$ nc -U /tmp/watcher.sock

my netcat (Debian 8) don’t support a ‘-U’ option

82ERROR

www.gutenberg.org/cache/epub/feeds/rdf-files.tar.bz2

is blocked for german IP

83ERROR

In the section asking the reader to download the data via the command: “curl -O link/to/rdf-files.tar.bz2”, it will not work because it points to a redirect. But even following redirects (using the -L flag) won’t work as the site warns against such behavior. Just download it in a browser and copy to the right path instead.

"DON’T USE THIS PAGE FOR SCRAPING.

Seriously. You’ll only get your IP blocked.

Download link instead,
which contains all Project Gutenberg metadata in one RDF/XML file."

95TYPO

After code example it refers to book.title as book.text. I denote the error below in its context and before the [sic].

Relevant section
> databases/lib/parse-rdf.js
> book.title = $(‘dcterms\\\\:title’).text();
> Using Cheerio, we select the tag named dcterms:title and save its text content
> to the book.text [sic] property. Once you save this file, your tests should pass again.

83ERROR

The Gutenberg website feeds URL was not accurate. The page no longer exists. I scrolled through the home page until I reached the Site Map heading. Then, I found the New Books Feeds page link under the Find eBooks section. That page had a download link to the rdf-files.tar.bz file at the bottom of the page. I then moved the file from my Downloads folder to the data folder and unzipped the file with the tar command.

234-9ERROR

Hi

I am currently trying to debug the facebook passport authentication
(chapter 9 p 234-239).

Seems facebook has disallowed http accessing authentication (from March
2018) and I am stuck trying to work out how to create an https web page.

The node.js documentation for creating an https server is fairly
straightforward, but I have so far been unable to tie that into nconf.

I am probably not the only person reading your book with this issue, but
I can’t find any postings or support pages to resolve it

117ERROR

The following code should not have “!” at the beginning.

if (!program.args.filter(arg => typeof arg === ‘object’).length) {
program.help();
}

The goal of this code is to run program.help() if the args array contains an object. But by negating everything, program.help() will only run if there isn’t any objects in the array.

238ERROR

Unfortunately Facebook discontinued it’s support for http authentication requests. They can no longer be configured on the app’s properties page. For this purpose the authentication via Facebook service is no longer possible for http web applications.
How ever a great book. I learned a lot during reading (And still as I’m only on page 238 by now)

238ERROR

Unfortunately Facebook discontinued it’s support for http authentication requests. They can no longer be configured on the app’s properties page. For this purpose the authentication via Facebook service is no longer possible for http web applications.
How ever a great book. I learned a lot during reading (And still as I’m only on page 238 by now)

238ERROR

Unfortunately Facebook discontinued it’s support for http authentication requests. They can no longer be configured on the app’s properties page. For this purpose the authentication via Facebook service is no longer possible for http web applications.
How ever a great book. I learned a lot during reading (And still as I’m only on page 238 by now)

1782SUGGEST

Windows 10 users 0mq install -> node install —save zeromq - trying to get a specific version sends readers down compilation rabbit hole and dependency loops. Once installed, Windows users will run into api.zeromq.org/4-2:zmq-ipc “The inter-process transport is currently only implemented on operating systems that provide UNIX domain sockets.” That makes the cluster example zmq-filer-rep-cluster.js, throw unhandled exceptions of the type zeromq\\lib\\index.js:519
this._zmq.connect(addr);
^
Error: Protocol not supported
The fix is quite simple though use tcp instead of :
const dealer = zmq.socket(‘dealer’).bind(‘ipc://filer-dealer.ipc’);
const responder = zmq.socket(‘rep’).connect(‘ipc://filer-dealer.ipc’);
these mods worked for me:
const dealer = zmq.socket(‘dealer’).bind(‘tcp://127.0.0.1:60402’);
const responder = zmq.socket(‘rep’).connect(‘tcp://127.0.0.1:60402’);

> node zmq-filer-rep-cluster.js
Worker 19532 is online.
Worker 19356 is online.
Worker 15992 is online.
Worker 19644 is online.
19532 received request for: ../filesystem/target.txt
19532 sending response
19356 received request for: ../filesystem/target.txt
19356 sending response
15992 received request for: ../filesystem/target.txt
15992 sending response
19644 received request for: ../filesystem/target.txt
19644 sending response
19532 received request for: ../filesystem/target.txt
19532 sending response

- cool!

123TYPO

In the listing that we get back from Elasticsearch, two of the response lines are run together on the same line

/_cat/thread_pool/{thread_pools}/_cat/plugins

should be two separate lines.

78ERROR

Bidirectional Messaging code is missing in the code download

54SUGGEST

Installing the 0mq package on Windows 10 was extremely painful because I did not have the Windows Build Tools installed, and on top of that, I had versions of Python (3.7) and Node (13.5.0) installed that were incompatible.

I followed instructions on a blog and finally got the package to install after downgrading to Python 2.7 and Node 10.18.0. Since I can’t post links, if anyone gets stuck, Google “A Comprehensive Guide to Fixing Node-Gyp Issues on Windows.”

71SUGGEST

Examples in this book are really problematic if you’re on a Windows environment. The code in “microservices/zmq-filter-rep-cluster.js” uses the IPC protocol, which is not supported on Windows. I’m trying to fallback to TCP based on earlier examples, but it doesn’t work with REP socket type.

86SUGGEST

const rdf = fs.readFileSync(`${__dirname}/pg132.rdf`);

there are two(2) underscores in front of __dirname
the printed version is harder to see

Categories: