49688 (4) [Avatar] Offline
Thanks for the hard work that it takes to update to a second edition!

All of the comments below assume a reader who is not familiar with node and its conventions.


The "full example" at the beginning of section 2.2 results in a warning message on the console, which the text doesn't prepare the reader for.

npm WARN using --force I sure hope you know what you are doing.


The beginning of section 2.2 uses the command "mkdir my_module" to create the directory for these examples, which is consistent with Figure 2.3.

But Figure 2.4 seems to refer to a directory named "currency_app" instead.

Assuming that this name is just a typo, the diagram clearly indicates a single directory with two files: "test-currency.js" and "currency.js". Great!


The second paragraph in section 2.4 talks about what happens if "... require './currency'" is replaced with "...require 'currency'", using the detailed flowchart in Figure 2.5. But for the reader who has followed along by creating and running the code, there is no explanation of how to adjust the sample project in hand to make that replacement work.

Removing the "./" prefix in "test-currency.js" and running the result with
node test-currency.js
now results in an error message, even though "currency.js" is in "the same directory as the program file" (per the top flowchart block in Figure 2.5). Moving "currency.js" into a sub-directory named "node-modules" yields the same error message.

It would really be helpful to have a specific explanation of exactly what to change in the code samples (and "package.json" file, if necessary) to allow the removal of the explicit reference to current directory. It would be even better to include in that explanation an "after" diagram equivalent to Figure 2.4 to show what has to be present (and where) for the change to work.