Skip to content

Commit a6bab7f

Browse files
authored
Fix source code installation bug (#1285)
* Fix wasm-pack not found error * Fix source code installation bug
1 parent 1f27187 commit a6bab7f

File tree

3 files changed

+1817
-1797
lines changed

3 files changed

+1817
-1797
lines changed

frontend/scripts/install.sh

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@ cd "${SCRIPT_DIR}/.."
1010
# https://rustup.rs/
1111
if ! hash rustup 2>/dev/null; then
1212
curl https://sh.rustup.rs -sSf | sh -s -- --no-modify-path -y
13-
PATH="$HOME/.cargo/bin:$PATH"
13+
export PATH="$HOME/.cargo/bin:$PATH"
1414
fi
1515

1616

1717
# wasm-pack
1818
# wasm-pack will be installed by npm package
1919
# https://rustwasm.github.io/wasm-pack/installer/
2020
if ! hash wasm-pack 2>/dev/null; then
21-
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
21+
# curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
22+
cargo install wasm-pack --version 0.9.1
23+
export PATH="$HOME/.cargo/bin:$PATH"
2224
fi
2325

2426
# copy wasm-pack
@@ -45,6 +47,23 @@ fi
4547

4648
export PATH=$PATH
4749

50+
51+
node_version=$(node -v)
52+
53+
54+
if [[ "$node_version" =~ v([0-9]+)\.([0-9]+)\.([0-9]+) ]]; then
55+
major_version=${BASH_REMATCH[1]}
56+
57+
if [[ $major_version -ge 17 ]]; then
58+
echo "Node.js version is $node_version. Enabling legacy OpenSSL provider..."
59+
export NODE_OPTIONS=--openssl-legacy-provider
60+
else
61+
echo "Node.js version is $node_version. No need to enable legacy OpenSSL provider."
62+
fi
63+
else
64+
echo "Could not determine Node.js version."
65+
fi
66+
4867
# yarn install
4968
yarn install --frozen-lockfile --network-timeout 1000000
5069

0 commit comments

Comments
 (0)