From 19ce47c6a981791bb319a60ee4f926916b34b28b Mon Sep 17 00:00:00 2001 From: CanbiZ <47820557+MickLesk@users.noreply.github.com> Date: Wed, 25 Jun 2025 12:05:53 +0200 Subject: [PATCH] Update tools.func --- misc/tools.func | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/misc/tools.func b/misc/tools.func index 583103c5..2b4b5769 100644 --- a/misc/tools.func +++ b/misc/tools.func @@ -69,6 +69,15 @@ function setup_nodejs() { export NODE_OPTIONS="--max-old-space-size=4096" + # Ensure valid working directory for npm (avoids uv_cwd error) + if [[ ! -d /opt ]]; then + mkdir -p /opt + fi + cd /opt || { + msg_error "Failed to set safe working directory before npm install" + exit 1 + } + # Install global Node modules if [[ -n "$NODE_MODULE" ]]; then IFS=',' read -ra MODULES <<<"$NODE_MODULE"