rustwasm / wasm_game_of_life

A Rust and WebAssembly tutorial implementing the Game of Life
Apache License 2.0
275 stars 75 forks source link

Cannot create www directory #117

Open JasonGoemaat opened 1 month ago

JasonGoemaat commented 1 month ago

Describe the Bug

Following the instructions in the book I'm getting this error:

jason@LAPTOP-KUS5B2I0 MINGW64 /c/git/rust/wasm-game-of-life (master)
$ npm init wasm-app www
npm error could not determine executable to run
npm error A complete log of this run can be found in: C:\Users\jason\scoop\persist\nodejs\cache\_logs\2024-07-21T23_46_03_815Z-debug-0.log

Versions:

$ node --version
v22.5.1

$ npm --version
10.8.2

$ cargo --version
cargo 1.79.0 (ffa9cf99a 2024-06-03)

$ rustup --version
rustup 1.27.1 (54dd3d00f 2024-04-24)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: The currently active `rustc` version is `rustc 1.79.0 (129f3b996 2024-06-10)`

$ rustc --version
rustc 1.79.0 (129f3b996 2024-06-10)

Steps to Reproduce

  1. Follow the tutorial
cargo generate --git https://github.com/rustwasm/wasm-pack-template

# enter wasm-game-of-life

cd wasm-game-of-life

wasm-pack build

npm init wasm-app www

Expected Behavior

The www directory should be created with the web page project to use the output of the rust wasm build.

Actual Behavior

This error:

npm error could not determine executable to run
npm error A complete log of this run can be found in: C:\Users\jason\scoop\persist\nodejs\cache\_logs\2024-07-21T23_51_45_084Z-debug-0.log

Happens with these commands I tried

Additional Context

Using Windows 10 and tried with git bash and windows command prompt

deanbear commented 1 month ago

my solution (it's weird but works for me):

on your wasm-game-of-life directory,

  1. npm install -g create-wasm-app
  2. new a package.json file in root dir:
    {
    "dependencies": {
    "create-wasm-app": "/usr/local/lib/node_modules/create-wasm-app"
    }
    }
  3. npm install
  4. npm init wasm-app www
  5. 🦀 Rust + 🕸 Wasm = ❤

my environment:

npm verbose os Darwin 21.6.0
npm verbose node v22.5.1
npm verbose npm  v10.8.2
gplanansky commented 1 month ago

ditto error as reported by JasonGoemaat above

ditto, identical workaround solution as reported by deanbear above (thank you!)

environment: macOS 13.6.7 arm64e node v22.5.1 npm 10.8.2 cargo 1.79.0 (ffa9cf99a 2024-06-03) cargo generate-generate 0.21.3 rustc 1.79.0 (129f3b996 2024-06-10) rustup 1.27.1 (54dd3d00f 2024-04-24) wasm-pack 0.13.0