解决方案

    ls -l /usr/local/bin | grep node 查看 node 是否存在

    1. # 1、打开命令行终端,输入:
    2. which node
    3. # 应该会显示:
    4. /Users/yuemeng/.nvm/versions/node/v14.17.3/bin/node
    5. # 2、做一个替身到/usr/local/bin下:
    6. sudo ln -s /Users/yuemeng/.nvm/versions/node/v14.17.3/bin/node /usr/local/bin/node
    7. # npm 同理
    8. sudo ln -s /Users/yuemeng/.nvm/versions/node/v14.17.3/bin/npm /usr/local/bin/npm

    参考:https://stackoverflow.com/questions/44983472/how-to-run-javascript-code-in-visual-studio-code-bin-sh-1-node-not-found