When you use volta install to install a package binary from NPM, volta chooses a node version to pin to that package using the following rules (from the docs):
If the package has engines specified in package.json, use the latest LTS version of Node that meets the requirements
If no LTS versions meet the requirements then use the latest overall version that satisfies engines
If engines isn鈥檛 available, use the most recent LTS version of Node
This often results in a good choice. However, sometimes you need to pick a different version than volta would have picked to workaround bugs. For example, if a dependency of the binary is broken under latest node, there is currently no supported way to downgrade.
A current workaround is to manually edit json files under ~/.volta/tools/user/bins and ~/.volta/tools/user/packages.
A related issue is that the only supported way to upgrade the pinned node version is to uninstall and reinstall the package binary. A solution to the downgrade problem could probably be designed to also offer upgrades, without needing to reinstall the whole package binary.
I also like this feature request.
Some packages just specify minimum Node version in their engines property, leaving maximum version as not specified. How can they know, that their package will work with any future version of Node? It's just impossible to know that beforehand.
Examples:
gulp@3 specifies "node": ">= 0.9".[email protected] specifies "node": ">=0.10.0".Today, if I run volta install gulp@3 it will work with current LTS Node (12.x).
Tomorrow - I don't know. Gulp v3 is unsupported anymore. It will never be updated. So, if it happens to next LTS Node version doesn't work with it, there is no way to fix it with some volta argument. Only manually editing Volta's config files.
@xak2000 That's a good call-out for how an old package could wind up breaking. This is definitely a feature we should implement, we will likely need an RFC to work out the design / UX for how it should work.
Related issue https://github.com/microsoft/rushstack/issues/1997
As of Volta 0.9.0, this should be possible. The approach is discussed in the announcement blog post under "Direct Control Over Pinned Node Version"
Thanks!