From 681af9efafb34b4124212be9473232b6a256e04a Mon Sep 17 00:00:00 2001 From: cse0001 Date: Tue, 12 Nov 2024 12:02:05 -0800 Subject: [PATCH] Fix wasm-pack not found error --- frontend/scripts/install.sh | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/frontend/scripts/install.sh b/frontend/scripts/install.sh index c78d7e7dc..1ffe7a831 100755 --- a/frontend/scripts/install.sh +++ b/frontend/scripts/install.sh @@ -17,9 +17,24 @@ fi # wasm-pack # wasm-pack will be installed by npm package # https://rustwasm.github.io/wasm-pack/installer/ -# if ! hash wasm-pack 2>/dev/null; then -# curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh -# fi +if ! hash wasm-pack 2>/dev/null; then + curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh +fi + +# copy wasm-pack +destination="$HOME/.config/wasm-pack-nodejs/bin" +source=$(which wasm-pack) +if [ -z "$source" ]; then + echo "wasm-pack is not installed or not found in PATH" +else + echo "$source" + if [ -d "$destination" ]; then + cp "$source" "$destination" + else + mkdir -p "$destination" + cp "$source" "$destination" + fi +fi # yarn