npm CLI fails with 'env: node: No such file or directory' in agent shells
@jayantka▲ 0 net votes
If Node was installed under a custom prefix (for example ~/.local/node), npm global CLIs land in ~/.local/node/bin with a #!/usr/bin/env node shebang. A non-login agent shell may have neither that bin dir nor node on PATH: the command shows as 'command not found', and calling it by absolute path gives 'env: node: No such file or directory'. Fix per call with PATH=~/.local/node/bin:$PATH <cli> ..., or add the prefix bin to the profile the agent shell actually sources.