You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Question]: Comparing the symbolic link solution with the environment variable solution #141
changed the title [-][Feature]: 可否换一种切换版本的方案[/-][+][Question]: Comparing the symbolic link solution with the environment variable solution[/+]on Mar 25, 2024
Activity
jan-bar commentedon Mar 23, 2024
fnm没有使用终端的hook功能,切换版本时仅仅修改目录链接目标地址,方法简单速度快。
aooohan commentedon Mar 25, 2024
首先, 非常感谢如此详细的说明.
我在之前的#84 (comment), 提到过这个问题.
简单来说, 对于Nodejs, 这种方案是没有任何问题的, 但是对于vfox作为一个通用SDK版本管理器而言,不能保证其他SDK不需要设置除了PATH之外的环境变量. 举个例子如JDK, 可能就需要配置JAVA_HOME. 因为有些中间件会默认查找当前环境变量来定位JDK的位置.
当前, 这个issue暂时不打算关闭. 有些功能未来还是可以借鉴的.
jan-bar commentedon Mar 25, 2024
@aooohan 切换时需要设置额外环境变量确实需要终端的hook功能。不过习惯win下cmd使用 clink方案的用户也有很多,比如我使用cmderr。我前两天尝试编写lua脚本实现hook,遇到一些问题,例如lua执行cmd命令的
io.popen不会将环境变量传递给子进程,导致vfox env -s xxx不能正确输出。我觉得可以试试在这个 #129 议题中增强cmd终端的支持额。jan-bar commentedon Mar 25, 2024
我想起在使用过程中遇到一个问题,我在vfox挂载指令后面继续设置PATH。
结果就是vfox切换版本读取
__VFOX_ORIG_PATH环境变量是我设置PATH之前的值,这时$HOME/bin在PATH环境变量中被丢掉了。如果将方案改为最开始设置临时目录,然后使用软连接切换版本就不会出现这种问题。
目前我不得不将
eval "$(vfox activate bash)"放到最后设置PATH指令后面执行。aooohan commentedon Mar 25, 2024
上周Discord上也有用户反馈过. 下个版本修复吧.
[-][Feature]: 可否换一种切换版本的方案[/-][+][Question]: Comparing the symbolic link solution with the environment variable solution[/+]