From 1f27187c877fbc13de1aaaf3a05458d9255aa7ca Mon Sep 17 00:00:00 2001 From: csexyf Date: Wed, 13 Nov 2024 16:00:37 +0800 Subject: [PATCH] Fix wasm-pack not found error (#1284) --- 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