首页 > 解决方案 > nvm设置后如何解决Sourcetree节点路径问题?

问题描述

在使用多个版本的节点设置 nvm 后,Sourcetree 开始抛出如下错误。Sourcetree 无法找到确切的节点路径。

如何将默认 nodePath 设置为 Sourcetree 的目标?

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.jsgitatlassian-sourcetree

解决方案


我通过几个步骤进行了管理

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"

像魅力一样工作


推荐阅读