marijnh / Eloquent-JavaScript

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

Ch:21 localStorage is not defined #503

Closed JulioDavidCh closed 4 years ago

JulioDavidCh commented 4 years ago

I get the error when trying to run the skillsharing_client.js file with node, i got node v12.13.0 installed and also installed the esctatic package. I downloaded the files of the project here https://eloquentjavascript.net/code/skillsharing.zip and this is the error i get when running it: https://imgur.com/NkT8H1A

marijnh commented 4 years ago

localStorage is a browser thing—you appear to be running a script meant for the browser in node. To start the server, start skillsharing_server.js with node.

zzehli commented 3 years ago

Just to add some further instructions: first run the server with node skillsharing_server.js (no output on the terminal while the server is live, and don't close the program), then open the browser and type localhost:8000 and you will see the website. No need to open the public folder.