Scripts: Use absolute "/root/.cache/npm" path in install-nodejs.sh

When invoked as "sudo bash install-nodejs.sh" by an unprivileged user, "~"
expanded to the calling user's home before sudo elevated, so root's
".npmrc" ended up with "cache=/home/<user>/.cache/npm" and subsequent
"sudo npm install -g" runs left root-owned cache dirs inside the user's
home. Hardcode the path so the cache always lands under root.
This commit is contained in:
Cathie Integra 2026-04-28 14:47:38 +02:00
parent bb53e9e972
commit 7f4b9ad668

View file

@ -48,7 +48,7 @@ fi
# Upgrade NPM and install development dependencies.
echo "Configuring NPM..."
sudo npm config set cache ~/.cache/npm
sudo npm config set cache /root/.cache/npm
echo "Updating NPM..."
sudo npm install -g --ignore-scripts --no-fund --no-audit --no-update-notifier "npm@$NPM_VERSION" n@latest
echo "Installing npm-check-updates and license-report..."