Cannot find runtime 'node' on PATH - Visual Studio Code and Node.js

后端 未结 18 2277
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-07 23:54

With a downloaded and installed version of Visual Studio Code 1.2.1, and a 64bit version of node.exe msi placed in my working directory (I am assuming that is correct), how

相关标签:
18条回答
  • 2020-12-08 00:40

    i resolved this problem after disable ESLint extention.

    0 讨论(0)
  • 2020-12-08 00:40

    If you are under Linux and using .nvm and node/npm/yarn are working in regular terminal but it doesn't work in VSCode - it's because .nvm add node to $PATH only when you open terminal window (~/.bashrc file), but VSCode's terminal is /bin/sh by default. Just press Ctrl+Shift+P and select "Terminal: Select default shell". In my case, it was /usr/bin/tmux for Kali Linux.

    0 讨论(0)
  • 2020-12-08 00:41

    Do not launch the VS code from the start menu separately. Use

    $Code .

    command to launch VS code. Now, create your file with the extension .js and Start debugging (F5) it. It will be executed.

    Otherwise, restart your system and follow the same process.

    0 讨论(0)
  • 2020-12-08 00:41

    I also encountered this issue. Did the following and it got fixed.

    1. Open your computer terminal (not VSCode terminal) and type node --version to ensure you have node installed. If not, then install node using nvm.
    2. Then head to your bash file (eg .bashrc, .bash_profile, .profile) and add the PATH:
     [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"  # This loads nvm 
     [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
    
    1. If you have multiple bash files, you ensure to add the PATH to all of them.
    2. Restart your VSCode terminal and it should be fine.
    0 讨论(0)
  • 2020-12-08 00:42

    I use /bin/zsh, and I changed vscode to do the same, but somehow vscode still use the path from /bin/bash. So I created a .bash_profile file with node location in the path.

    Simply run in terminal:

    echo "PATH=$PATH
    export \$PATH" >> ~/.bash_profile
    

    Restart vscode, and it will work.

    0 讨论(0)
  • 2020-12-08 00:43

    For me, the node binary is in PATH and I can run it from the terminal (iTerm or Terminal), and the Terminal apps are set to use zsh

    If you are on a Mac, with iTerm and Zsh, please use the following VSCode settings for Node to work.

    After this change, you can get rid of this line from your launch.json config file. (the debug settings in VSCode)

        "runtimeExecutable": "/usr/local/bin/node"
    

    If this doesn't work, make sure you choose the default shell as zsh. To do this,

    • Open the command palette using Cmd+Shift+P

    • Look for the Terminal: Select Default Shell command

    • Select zsh from the options

    0 讨论(0)
提交回复
热议问题