version-fox / vfox

A cross-platform and extendable version manager with support for Java, Node.js, Flutter, .Net & more
https://vfox.lhan.me
Apache License 2.0
2.68k stars 95 forks source link

[BUG]: Bun installation error #315

Closed Doodidan closed 2 months ago

Doodidan commented 2 months ago

Version 0.5.3 OS Windows

Describe the bug

vfox install bun@latest
plugin [PreInstall] method error: no version number provided
failed to install bun

Actually there is fix in ahai-code/vfox-bun#2 but it doesn't work for latest keyword. Also vfox-bun repo seems to be not maintained for 2 months already so any attention will be appreciated.

yanecc commented 2 months ago

The version codes such as latest are not necessarily designed by the plugin author. Here is a temporary patch to enable the use of latest, add the following code before the loop in the PreInstall function of the bun plugin:

    table.sort(releases, function(a, b)
        return util:compare_versions(a, b)
    end)
    if ctx.version == "latest" then
        return releases[1]
    end
ahai-code commented 2 months ago

I have fixed this issue. Please upgrade the plugin to 0.1.2.