fix(server): resolve node/npm by absolute path in AI CLI Tools step - #35
Open
sandrolborges wants to merge 1 commit into
Open
fix(server): resolve node/npm by absolute path in AI CLI Tools step#35sandrolborges wants to merge 1 commit into
sandrolborges wants to merge 1 commit into
Conversation
The Node.js version check and npm resolution in step_7 relied on `command -v`/PATH lookups. On machines with a Node version manager (nvm, fnm, volta, asdf) installed, that manager's bin directory is typically ahead of /usr/bin on PATH, so `node`/`npm` resolved to the manager's Node instead of the Node 24 just installed via NodeSource. Combined with `set -Eeuo pipefail`, this made the version check fail silently, aborting the step with no visible error message. It also meant the subsequent npm installs of claude-code/codex/copilot/skills could run against the wrong Node/npm via npm's `#!/usr/bin/env node` shebang. Resolve node/npm by the paths dpkg actually installed them to, and invoke npm through that node explicitly (bypassing shebang-based PATH resolution) so the step is correct regardless of what's shadowing PATH. Fixes promovaweb#34
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problema
Na Etapa 7 (
AI CLI Tools) doserver.sh, o Node.js 24 é instalado via NodeSource/APT e validado com:Em máquinas com um gerenciador de versões Node instalado (
nvm,fnm,volta,asdf), obin/desse gerenciador costuma vir antes de/usr/binnoPATH. Isso faznode/command -v npmresolverem para a versão do gerenciador em vez do Node 24 recém-instalado.Com
set -Eeuo pipefail, a falha dogrep -Eqaborta a etapa sem nenhuma mensagem de erro visível — o usuário só vê "Step failed" no resumo final, sem pista da causa real. O mesmo problema afeta silenciosamente as instalações seguintes dos pacotes npm (@anthropic-ai/claude-code,@openai/codex,@github/copilot,skills@latest), já que onpmresolve seu interpretador via shebang#!/usr/bin/env node, também sujeito aoPATH.Reportado em #34, encontrado logo após reproduzir #29 / #30 (as duas falhas juntas bloqueiam totalmente uma instalação
--yesneste tipo de ambiente).Correção
Resolve
node/npmpelos caminhos que odpkgefetivamente instalou (dpkg -L nodejs), em vez de depender decommand -v/PATH, e invoca onpmexplicitamente através dessenode(em vez de confiar no shebang) nas chamadas de instalação/verificação. Assim a etapa fica correta independentemente do que estiver na frente doPATH.Mudança cirúrgica, restrita à função
step_7()deserver.sh.Ambiente testado
nvmcom Node v22.23.0 ativo (reproduz o bug antes da correção)Test plan
bash -n server.sh— sintaxe okshellcheck server.sh— sem warnings novos (0 antes, 0 depois)step_7()nvmativo (não reexecutei o instalador completo neste fork; a lógica replica exatamente o contorno manual que resolveu o problema no ambiente original)Fixes #34