Skip to content

Commit

Permalink
fix: node path detection for lazy loading (#555)
Browse files Browse the repository at this point in the history
NVM lazy loading use cases such as the Oh My Zsh `nvm` plugin might make node a function which will be executed to set the node path when it is run, so executed the `node` command if it is a function to make it point to the real Node binary.
  • Loading branch information
CHC383 authored Dec 16, 2024
1 parent 7b96bde commit 4f41223
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ async function findNodeViaShell(cwd: string): Promise<string | undefined> {
const startToken = '___START_SHELL__'
const endToken = '___END_SHELL__'
try {
const childProcess = spawn(`${vscode.env.shell} -i -c 'echo ${startToken} && which node && echo ${endToken}'`, {
const childProcess = spawn(`${vscode.env.shell} -i -c 'if type node 2>/dev/null | grep -q "function"; then node --version; fi; echo ${startToken} && which node && echo ${endToken}'`, {
stdio: 'pipe',
shell: true,
cwd,
Expand Down

0 comments on commit 4f41223

Please sign in to comment.