在使用多个版本的节点进行 nvm 设置后,Sourcetree 开始抛出如下错误。 Sourcetree 无法找到确切的节点路径。
如何设置Sourcetree的默认nodePath为目标?
Info: can't find node in PATH, trying to find a node binary on your system
/Users/project-ui/node_modules/husky/run.js:8
message(requiredVersion) {
^
SyntaxError: Unexpected token (
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:929:3
Completed successfully
我通过几个步骤就成功了
which node
:/Users/xyz/.nvm/versions/node/v12.18.2/bin/node
我将其添加到 bash_profile 中的路径变量中:
export PATH="/Users/xyz/.nvm/versions/node/v12.18.2/bin:$PATH"
工作起来很有魅力
nvm alias default node
并重新启动 VS Code 解决了我的问题!