Pswish week7 - TheEvergreenStateCollege/upper-division-cs-23-24 GitHub Wiki

Today, 13 May 2024. I embarked on building the wasm-game-of-life

before starting, i had to troubleshoot why apt update wasn't working locally on ubuntu.

I added these to my /etc/apt/source.list

deb http://archive.ubuntu.com/ubuntu $(lsb_release -* * sc) main restricted 

deb http://archive.ubuntu.com/ubuntu $(lsb_release -sc)-updates main restricted

deb http://security.ubuntu.com/ubuntu $(lsb_release -sc)-security main restricted

Run : sudo apt update
Run : sudo apt install build-essential  
Run : sudo apt install pkg-config 
Run : cargo install cargo-generate
Run : cargo generate --git https://github.com/rustwasm/wasm-pack-template
Project Name: pswish-game_of_life

I didn't make it all the way through hello wold successfully. I had issues getting the package.json to appear during the build step: wasm-pack build. I manually created the package.json and moved on.

I progressed all the way to: npm run start but the error i received was missing node-packages so I knew some of the npm install stuff didn't work correctly so I figure this is related to the common errors encountered in class.

I figured it was time to track down bugs as well, as I noticed some disconnect with my custom naming convention so I decided to start fresh and restore the default normal naming convention which meant starting the guide over. With only 20 minutes left in class, i was able to reproduce my missing package.json error. so more checking is needed. I also noticed that when i run the wasm-pack build, it removes the package.json from the pkg/ directory.

Here is my node version:

➜ node -v
v20.11.0
Rust: 1.78.0
➜ rustup -v
verbose: read metadata version: '12'
rustup 1.27.1 (54dd3d00f 2024-04-24)

  Compiling wasm-game-of-life v0.1.0 (/home/ubuntu/Workspace/upper-division-cs/sc-24sp/assignments/pswish-sc/game-of-life2/wasm-game-of-life)
warning: function `set_panic_hook` is never used
--> src/utils.rs:1:8
 |
1 | pub fn set_panic_hook() {
 |        ^^^^^^^^^^^^^^
 |
 = note: `#[warn(dead_code)]` on by default

Here is the warnings from the build output:
warning: `wasm-game-of-life` (lib) generated 1 warning
   Finished `release` profile [optimized] target(s) in 8.34s
[INFO]: ⬇️  Installing wasm-bindgen...
Error: failed to download from https://github.com/WebAssembly/binaryen/releases/download/version_111/binaryen-version_111-x86_64-linux.tar.gz
To disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.
Caused by: failed to download from https://github.com/WebAssembly/binaryen/releases/download/version_111/binaryen-version_111-x86_64-linux.tar.gz
To disable `wasm-opt`, add `wasm-opt = false` to your package metadata in your `Cargo.toml`.

they didn't look important enough for the current state to track down.

For Round 2, here is where the build step missed the package ubuntu in upper-division-cs/sc-24sp/assignments/pswish-sc/game-of-life2/wasm-game-of-life at ip-172-31-1-136 on ξ‚  pswish-week6 [$!?] is πŸ“¦ 0.1.0 via πŸ¦€ 1.78.0 … ➜ tree .

β”œβ”€β”€ Cargo.lock
β”œβ”€β”€ Cargo.toml
β”œβ”€β”€ LICENSE_APACHE
β”œβ”€β”€ LICENSE_MIT
β”œβ”€β”€ README.md
β”œβ”€β”€ pkg
β”‚   β”œβ”€β”€ wasm_game_of_life.d.ts
β”‚   β”œβ”€β”€ wasm_game_of_life.js
β”‚   β”œβ”€β”€ wasm_game_of_life_bg.js
β”‚   β”œβ”€β”€ wasm_game_of_life_bg.wasm
β”‚   └── wasm_game_of_life_bg.wasm.d.ts
β”œβ”€β”€ src
β”‚   β”œβ”€β”€ lib.rs
β”‚   └── utils.rs
β”œβ”€β”€ target
β”‚   β”œβ”€β”€ CACHEDIR.TAG
β”‚   β”œβ”€β”€ release
β”‚   β”‚   β”œβ”€β”€ build
β”‚   β”‚   β”‚   β”œβ”€β”€ proc-macro2-0940ada6172e5625
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ invoked.timestamp
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ out
β”‚   β”‚   β”‚   β”‚   β”‚   └── proc_macro2.d
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ output
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ root-output
β”‚   β”‚   β”‚   β”‚   └── stderr
β”‚   β”‚   β”‚   β”œβ”€β”€ proc-macro2-5a1e983aa966ac14
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ build-script-build
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ build_script_build-5a1e983aa966ac14
β”‚   β”‚   β”‚   β”‚   └── build_script_build-5a1e983aa966ac14.d
β”‚   β”‚   β”‚   β”œβ”€β”€ wasm-bindgen-b735310bfeb45894
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ build-script-build
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ build_script_build-b735310bfeb45894
β”‚   β”‚   β”‚   β”‚   └── build_script_build-b735310bfeb45894.d
β”‚   β”‚   β”‚   β”œβ”€β”€ wasm-bindgen-shared-113a2b2dbcba8f61
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ invoked.timestamp
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ out
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ output
β”‚   β”‚   β”‚   β”‚   β”œβ”€β”€ root-output
β”‚   β”‚   β”‚   β”‚   └── stderr
β”‚   β”‚   β”‚   └── wasm-bindgen-shared-e36f3c6d308317a4
β”‚   β”‚   β”‚       β”œβ”€β”€ build-script-build
β”‚   β”‚   β”‚       β”œβ”€β”€ build_script_build-e36f3c6d308317a4
β”‚   β”‚   β”‚       └── build_script_build-e36f3c6d308317a4.d
β”‚   β”‚   β”œβ”€β”€ deps
β”‚   β”‚   β”‚   β”œβ”€β”€ bumpalo-ef4f5ca44de48188.d
β”‚   β”‚   β”‚   β”œβ”€β”€ libbumpalo-ef4f5ca44de48188.rlib
β”‚   β”‚   β”‚   β”œβ”€β”€ libbumpalo-ef4f5ca44de48188.rmeta
β”‚   β”‚   β”‚   β”œβ”€β”€ liblog-4bd01053f5d669d0.rlib
β”‚   β”‚   β”‚   β”œβ”€β”€ liblog-4bd01053f5d669d0.rmeta
β”‚   β”‚   β”‚   β”œβ”€β”€ libonce_cell-d1fa5defe1046ec3.rlib
β”‚   β”‚   β”‚   β”œβ”€β”€ libonce_cell-d1fa5defe1046ec3.rmeta
β”‚   β”‚   β”‚   β”œβ”€β”€ libproc_macro2-793d24cc9432c2ac.rlib
β”‚   β”‚   β”‚   β”œβ”€β”€ libproc_macro2-793d24cc9432c2ac.rmeta
β”‚   β”‚   β”‚   β”œβ”€β”€ libquote-3cce769df9c53041.rlib
β”‚   β”‚   β”‚   β”œβ”€β”€ libquote-3cce769df9c53041.rmeta
β”‚   β”‚   β”‚   β”œβ”€β”€ libsyn-f3ad57d99bd63c38.rlib
β”‚   β”‚   β”‚   β”œβ”€β”€ libsyn-f3ad57d99bd63c38.rmeta
β”‚   β”‚   β”‚   β”œβ”€β”€ libunicode_ident-0ca6ee852c4f2b7d.rlib
β”‚   β”‚   β”‚   β”œβ”€β”€ libunicode_ident-0ca6ee852c4f2b7d.rmeta
β”‚   β”‚   β”‚   β”œβ”€β”€ libwasm_bindgen_backend-82b8087b3e6c31b4.rlib
β”‚   β”‚   β”‚   β”œβ”€β”€ libwasm_bindgen_backend-82b8087b3e6c31b4.rmeta
β”‚   β”‚   β”‚   β”œβ”€β”€ libwasm_bindgen_macro-a3be4812cecfe1d3.so
β”‚   β”‚   β”‚   β”œβ”€β”€ libwasm_bindgen_macro_support-7457a02e77f0bd25.rlib
β”‚   β”‚   β”‚   β”œβ”€β”€ libwasm_bindgen_macro_support-7457a02e77f0bd25.rmeta
β”‚   β”‚   β”‚   β”œβ”€β”€ libwasm_bindgen_shared-211b253108fb9041.rlib
β”‚   β”‚   β”‚   β”œβ”€β”€ libwasm_bindgen_shared-211b253108fb9041.rmeta
β”‚   β”‚   β”‚   β”œβ”€β”€ log-4bd01053f5d669d0.d
β”‚   β”‚   β”‚   β”œβ”€β”€ once_cell-d1fa5defe1046ec3.d
β”‚   β”‚   β”‚   β”œβ”€β”€ proc_macro2-793d24cc9432c2ac.d
β”‚   β”‚   β”‚   β”œβ”€β”€ quote-3cce769df9c53041.d
β”‚   β”‚   β”‚   β”œβ”€β”€ syn-f3ad57d99bd63c38.d
β”‚   β”‚   β”‚   β”œβ”€β”€ unicode_ident-0ca6ee852c4f2b7d.d
β”‚   β”‚   β”‚   β”œβ”€β”€ wasm_bindgen_backend-82b8087b3e6c31b4.d
β”‚   β”‚   β”‚   β”œβ”€β”€ wasm_bindgen_macro-a3be4812cecfe1d3.d
β”‚   β”‚   β”‚   β”œβ”€β”€ wasm_bindgen_macro_support-7457a02e77f0bd25.d
β”‚   β”‚   β”‚   └── wasm_bindgen_shared-211b253108fb9041.d
β”‚   β”‚   β”œβ”€β”€ examples
β”‚   β”‚   └── incremental
β”‚   └── wasm32-unknown-unknown
β”‚       β”œβ”€β”€ CACHEDIR.TAG
β”‚       └── release
β”‚           β”œβ”€β”€ build
β”‚           β”‚   └── wasm-bindgen-23391f03dfcddf87
β”‚           β”‚       β”œβ”€β”€ invoked.timestamp
β”‚           β”‚       β”œβ”€β”€ out
β”‚           β”‚       β”œβ”€β”€ output
β”‚           β”‚       β”œβ”€β”€ root-output
β”‚           β”‚       └── stderr
β”‚           β”œβ”€β”€ deps
β”‚           β”‚   β”œβ”€β”€ cfg_if-eb1887cd077d37ae.d
β”‚           β”‚   β”œβ”€β”€ console_error_panic_hook-687e96ccba4b2a44.d
β”‚           β”‚   β”œβ”€β”€ libcfg_if-eb1887cd077d37ae.rlib
β”‚           β”‚   β”œβ”€β”€ libcfg_if-eb1887cd077d37ae.rmeta
β”‚           β”‚   β”œβ”€β”€ libconsole_error_panic_hook-687e96ccba4b2a44.rlib
β”‚           β”‚   β”œβ”€β”€ libconsole_error_panic_hook-687e96ccba4b2a44.rmeta
β”‚           β”‚   β”œβ”€β”€ libwasm_bindgen-0cd01c8bbdcdc1b8.rlib
β”‚           β”‚   β”œβ”€β”€ libwasm_bindgen-0cd01c8bbdcdc1b8.rmeta
β”‚           β”‚   β”œβ”€β”€ libwasm_game_of_life.rlib
β”‚           β”‚   β”œβ”€β”€ wasm_bindgen-0cd01c8bbdcdc1b8.d
β”‚           β”‚   β”œβ”€β”€ wasm_game_of_life.d
β”‚           β”‚   └── wasm_game_of_life.wasm
β”‚           β”œβ”€β”€ examples
β”‚           β”œβ”€β”€ incremental
β”‚           β”œβ”€β”€ libwasm_game_of_life.d
β”‚           β”œβ”€β”€ libwasm_game_of_life.rlib
β”‚           β”œβ”€β”€ wasm_game_of_life.d
β”‚           └── wasm_game_of_life.wasm
└── tests
    └── web.rs

24 directories, 85 files

Next up, i ran through the setup steps in this wiki: https://github.com/TheEvergreenStateCollege/upper-division-cs/wiki/SC%E2%80%90Homework%E2%80%9007

I switched to node version 14 and tried proceeding. I went through the tutorial again and made it back to npm start. I ran into a missing the package.json again so i went to the /pkg/ directory and ran npm init. I ran npm install again and this time, that command worked since i didn't have npm setup properly before in the previous attempts.

I changed back to the www directory and ran:

ubuntu in www at ip-172-31-1-136 on ξ‚  master via β¬’ v14.21.3 …
➜ npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 587 packages from 362 contributors and audited 655 packages in 14.065s

18 packages are looking for funding
  run `npm fund` for details

found 149 vulnerabilities (11 low, 44 moderate, 74 high, 20 critical)
  run `npm audit fix` to fix them, or `npm audit` for details

ubuntu in www at ip-172-31-1-136 on ξ‚  master via β¬’ v14.21.3 took 14.9s …
➜ npm install
npm ERR! code ENOLOCAL
npm ERR! Could not install from "../pkg" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/ubuntu/.npm/_logs/2024-05-13T22_48_29_057Z-debug.log

ubuntu in www at ip-172-31-1-136 on ξ‚  master [!] via β¬’ v14.21.3 took 2.7s …
➜ npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 1 package in 4.494s

18 packages are looking for funding
  run `npm fund` for details


ubuntu in www at ip-172-31-1-136 on ξ‚  master [!] via β¬’ v14.21.3 took 5.3s …
➜ npm start

> [email protected] start /home/ubuntu/Workspace/upper-division-cs/sc-24sp/assignments/pswish-sc/game-of-life3/wasm-game-of-life/www
> webpack-dev-server

β„Ή ο½’wdsο½£: Project is running at http://localhost:8080/
β„Ή ο½’wdsο½£: webpack output is served from /
β„Ή ο½’wdsο½£: Content not from webpack is served from /home/ubuntu/Workspace/upper-division-cs/sc-24sp/assignments/pswish-sc/game-of-life3/wasm-game-of-life/www
β„Ή ο½’wdmο½£: Hash: 79e415562a0715ee6010
Version: webpack 4.43.0
Time: 683ms
Built at: 05/13/2024 10:49:37 PM
                           Asset       Size  Chunks                         Chunk Names
                  0.bootstrap.js   5.85 KiB       0  [emitted]              
                    bootstrap.js    369 KiB    main  [emitted]              main
ce37dcc1211ed0221a13.module.wasm   17.8 KiB       0  [emitted] [immutable]  
                      index.html  297 bytes          [emitted]              
Entrypoint main = bootstrap.js
[0] multi (webpack)-dev-server/client?http://localhost:8080 ./bootstrap.js 40 bytes {main} [built]
[../pkg/wasm_game_of_life.js] 178 bytes {0} [built]
[./bootstrap.js] 279 bytes {main} [built]
[./index.js] 58 bytes {0} [built]
[./node_modules/ansi-html/index.js] 4.16 KiB {main} [built]
[./node_modules/ansi-regex/index.js] 135 bytes {main} [built]
[./node_modules/strip-ansi/index.js] 161 bytes {main} [built]
[./node_modules/webpack-dev-server/client/index.js?http://localhost:8080] (webpack)-dev-server/client?http://localhost:8080 4.29 KiB {main} [built]
[./node_modules/webpack-dev-server/client/overlay.js] (webpack)-dev-server/client/overlay.js 3.51 KiB {main} [built]
[./node_modules/webpack-dev-server/client/socket.js] (webpack)-dev-server/client/socket.js 1.53 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/createSocketUrl.js] (webpack)-dev-server/client/utils/createSocketUrl.js 2.91 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/log.js] (webpack)-dev-server/client/utils/log.js 964 bytes {main} [built]
[./node_modules/webpack-dev-server/client/utils/reloadApp.js] (webpack)-dev-server/client/utils/reloadApp.js 1.59 KiB {main} [built]
[./node_modules/webpack-dev-server/client/utils/sendMessage.js] (webpack)-dev-server/client/utils/sendMessage.js 402 bytes {main} [built]
[./node_modules/webpack/hot sync ^\.\/log$] (webpack)/hot sync nonrecursive ^\.\/log$ 170 bytes {main} [built]
    + 23 hidden modules
β„Ή ο½’wdmο½£: Compiled successfully.

image