Install npm using Debian repository if not found
Replaced manual npm installation with apt install.
This commit is contained in:
parent
433119e830
commit
0ed95ea9cb
@ -2595,23 +2595,10 @@ function setup_nodejs() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# 🧩 Nodesource Node 22.x no longer includes npm → manual fix
|
|
||||||
if ! command -v npm >/dev/null 2>&1; then
|
if ! command -v npm >/dev/null 2>&1; then
|
||||||
msg_info "Installing npm manually (not included in Node ${NODE_VERSION} package)"
|
msg_warn "npm not found after Node.js install – installing manually"
|
||||||
local NPM_VERSION="10.9.2"
|
$STD apt install -y npm
|
||||||
local TMP_DIR="/tmp/npm-install"
|
msg_ok "Installed npm from Debian repository"
|
||||||
mkdir -p "$TMP_DIR"
|
|
||||||
curl -fsSL "https://registry.npmjs.org/npm/-/npm-${NPM_VERSION}.tgz" -o "$TMP_DIR/npm.tgz" || {
|
|
||||||
msg_error "Failed to download npm ${NPM_VERSION}"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
cd "$TMP_DIR" && tar -xzf npm.tgz && cd "package"
|
|
||||||
$STD node bin/npm-cli.js install -g "npm@${NPM_VERSION}" || {
|
|
||||||
msg_error "Manual npm installation failed"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
cd / && rm -rf "$TMP_DIR"
|
|
||||||
msg_ok "Installed npm ${NPM_VERSION}"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Update npm to latest (safe if manual install used)
|
# Update npm to latest (safe if manual install used)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user