nvm 设置后如何解决 Sourcetree 节点路径问题?

问题描述 投票:0回答:2

在使用多个版本的节点进行 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
node.js git atlassian-sourcetree
2个回答
1
投票

我通过几个步骤就成功了

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"

工作起来很有魅力


0
投票

nvm alias default node
并重新启动 VS Code 解决了我的问题!

© www.soinside.com 2019 - 2024. All rights reserved.