Steps to Reproduce:
Cannot find runtime 'node' on PATHnode command is in $PATH variable
Can you open the integrated terminal and run which node?
Which is the integrated terminal?
If you mean a normal shell, the results is this /Users/me/.nvm/versions/node/v0.12.7/bin/node
@bitliner in VS Code press 'F1' and then type 'integr'. You should see two suggestions one being a 'Create new integrated terminal'. Select and execute this. The integrated terminal will open at the bottom of the VS Code window. Enter which node there.
@weinand thank you, I did not know about that feature.
Btw, it still prints /Users/me/.nvm/versions/node/v0.12.7/bin/node
And the Cannot find runtime 'node' on PATH problem persists even after restarting VS Code?
Yes, it does. It does not also find jshint, even if which jshint works well inside the integrated terminal. But it displayes this error Failed to apply ESLint fixes to the document. Please consider opening an issue with steps to reproduce.
I have no idea what problem you are running into but the workaround is to launch VS Code from the command line: press 'F1', type 'shell' and execute the 'Install code...' command.
Then shutdown VS Code and launch it again from the command line with 'code'.
Now debugging should work.
Thank you. This way it works.
@joaomoreno any idea what is going wrong here?
@bitliner
Can you open the Developer Tools and run the following in the Console?
(function () {
const electron = "/Applications/Visual Studio Code - Insiders.app/Contents/MacOS/Electron";
const cp = require('child_process');
const env = Object.assign({}, process.env, {
ELECTRON_RUN_AS_NODE: '1',
ELECTRON_NO_ATTACH_CONSOLE: '1'
});
const command = `'${electron}' -p 'JSON.stringify(process.env)'`;
const result = cp.spawnSync(process.env.SHELL, ['-ilc', command], {
detached: true,
stdio: ['ignore', 'pipe', process.stderr],
env,
encoding: 'utf8'
});
console.log(result.stdout);
})()
Let me know what you get back.
to the many people having this issue, it's probably because they're using a mixture of NVM and/or a non-bash shell like Zsh or Fish. If you use NVM, then make sure that you keep/kept the following in ~/.bash_profile
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && . "$NVM_DIR/nvm.sh" # This loads nvm
restart vscode, and it should use the path correctly. you can confirm this by opening the Developer Tools in VSCode, and in the console, process.env.PATH
Thanks @moimikey
Closing due to inactivity
I think the problem occurs when opening a recent folder/project on a new window:
Steps to reproduce:
$ code .
File -> New Window
File -> Open Recent...
Try to debug ... and the Error appears
Version 1.8.1
Commit ee428b0eead68bf0fb99ab5fdc4439be227b6281
Date 2016-12-19T14:41:20.664Z
Shell 1.4.6
Renderer 53.0.2785.143
Node 6.5.0
Im still experiencing this in the latest insiders. would love to help debug.
@wprater Which OS? Does it work when running from the Terminal? When it doesn't repro, can you open the Developer Tools (with F1) and run process.env.PATH? Does the result make sense?
@joaomoreno 10.12.4
yes, node is available and correct in the integrated terminal. however, process.env.PATH is not set correctly.
if I am to open from the cli with code-insiders <path-to-dir> then it will setup the env.PATH correctly
Which shell do you use? Bash, ZSH, Fish?
Which shell do you use? Bash, ZSH, Fish?
Fish
Got it. You have exactly the same problem as @NinoFloris #21655.
I ask you the same I asked him in that issue:
Can you show me how your machine is configured? What's your fish version? What's its configuration & plugins? I want to reproduce your issue.
I'm using bash in ubuntu and I have this problem. I have a .bashrc/.bash_profile with the nvm exported from them and still no joy when I check the PATH inside code-insiders
@mredbishop Can you show me your .bash_profile, especially the part where nvm is configured? Also, what's your Code version?
I'm also experiencing this issue using a combination of ZSH and NVM. Installing the code command and running from VS Code circumvents the problem.
Using:
Mac OS 10.12.4
VS Code 1.12.2
My ZSH loads various configurations from $ZSH/custom, the file in charge on env looks like:
# Export vim
export EDITOR='vim'
##
# Environment Managers
# --------------------
# Yarn Path
export PATH="$HOME/.yarn/bin:$PATH"
# NVM
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nv
m bash_completion
# Android
export ANDROID_HOME=~/Library/Android/sdk
export PATH=${PATH}:${ANDROID_HOME}/tools
export PATH=${PATH}:${ANDROID_HOME}/platform-tools
# RVM
export PATH="$PATH:$HOME/.rvm/bin" # Add RVM to PATH for scripting
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM int
o a shell session *as a function*
# iTerm
test -e "${HOME}/.iterm2_shell_integration.zsh" && source "${HOME}/.iterm2_shell_in
tegration.zsh"
export OPENSSL_INCLUDE_DIR="$(brew --prefix openssl)/include"
export OPENSSL_LIB_DIR="$(brew --prefix openssl)/lib"
Hope this helps and look forward to a fix!
I am using nvm and I fixed the issue by adding
"runtimeExecutable": "/Users/x/.nvm/versions/node/v8.1.3/bin/node",
to launch.json.
to find nvm node executable path run which node
I'm running Linux Mint, nvm and fish.
I followed the instructions in https://github.com/Microsoft/vscode/issues/14229#issuecomment-276796749 and I still couldn't get it to work. I could see $PATH included the NVM path to the binary but it wasn't picking it up.
My launch.json had
"runtimeExecutable": "node",
...and removing that fixed my problem. I could then see in the Debug Console that the debug process was launched with /home/tom/.nvm/versions/node/v6.10.3/bin/node.
This achieves the same as the previous comment but won't break if you change version of Node with nvm (presumably, haven't actually tested that).
Hello, a information that maybe help. I鈥檓 running Linux Mint and NVM too and I had this problem when I start Visual Studio Code from a keyboard shortcut. When I started by clicking on the shortcut icon or typing 'code' on terminal I don鈥檛 have this problem.
I get this issue on linux launching code (latest version at this time, 1.17.2) using the gnome 3 alt+f2 quick launcher. This doesn't happen when launching code form a terminal, or using the "search everywhere" default launcher.
I don't use nvm and bash is my default shell, my PATH enviroment variable is set up in .bashrc, with one path pointing to /usr/local/node/bin.
My guess is the alt+f2 launcher has some kind of unusual config for setting up paths.
i have the same problem. different versions in normal terminal outside VSCode, but same shell (zsh).
on OSX..
Most helpful comment
to the many people having this issue, it's probably because they're using a mixture of NVM and/or a non-bash shell like Zsh or Fish. If you use NVM, then make sure that you keep/kept the following in
~/.bash_profilerestart vscode, and it should use the path correctly. you can confirm this by opening the Developer Tools in VSCode, and in the console,
process.env.PATH