rustwasm / book

The Rust and WebAssembly Book
https://rustwasm.github.io/docs/book/
MIT License
1.75k stars 211 forks source link

Section 4.2 Unclear - Cannot Continue with the Tutorial #180

Closed webern closed 5 years ago

webern commented 5 years ago

Where in the docs did you come across this?

4.2 Putting it into a Web Page

https://rustwasm.github.io/book/game-of-life/hello-world.html#putting-it-into-a-web-page

Describe what about it does not make sense

There is a link to a project create-wasm-app, but I'm not clear if I need to install this. Running npm init wasm-app www does not create a www directory for me, it only creates a package.json file (which is what I would expect npm init to do).

Why does it not make sense?

Immediately after the instruction to run npm init wasm-app www, it says

Here's what our new wasm-game-of-life/www subdirectory contains:

wasm-game-of-life/www/
├── bootstrap.js
├── index.html
├── index.js
├── LICENSE-APACHE
├── LICENSE-MIT
├── package.json
├── README.md
└── webpack.config.js

This did not happen for me. Instead npm init only created a package.json file which looks like this:

{
  "name": "wasm-game-of-life",
  "version": "1.0.0",
  "description": "<div align=\"center\">",
  "main": "index.js",
  "directories": {
    "test": "tests"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

How could we improve it?

Better explain how to generate these files

wasm-game-of-life/www/
├── bootstrap.js
├── index.html
├── index.js
├── LICENSE-APACHE
├── LICENSE-MIT
├── package.json
├── README.md
└── webpack.config.js
webern commented 5 years ago

Actually I solved this when I went to edit the original post with my node and npm versions. Turns out I was hitting node 8.x due to some emscripten thing. When I straightened it out to 10.16.X it worked as expected.

webern commented 5 years ago

Actually I want to reopen this. I think the documentation would be improved by adding something like this:

Run node --version You need to be running a node version 10.x Run npm --version You need to be running an npm version 6.x

Adjust the versions as necessary. That would have helped me spot the issue much faster.

Thanks!