marijnh / Eloquent-JavaScript

The sources for the Eloquent JavaScript book
https://eloquentjavascript.net
3.01k stars 793 forks source link

Suggested writeFile for exercise 21.1 returns "Error: Internal Server Error" #478

Closed alexandersandberg closed 5 years ago

alexandersandberg commented 5 years ago

The solution for exercise 21.1, suggesting using writeFile in the update function, gives me an alert with "Error: Internal Server Error", and the JSON is not written to the file.

Not sure if I'm doing something wrong with writeFile, but I managed to solve the problem by using the synchronous writeFileSync instead.

marijnh commented 5 years ago

Ah, right, newer versions of node have started requiring a 3rd argument to writeFile. I've updated the solution to pass one in attached patch.