In a folder which has a package.json, but no volta key set in it, running volta list outputs:
鈿★笍 No Node runtimes installed!
You can install a runtime by running `volta install node`. See `volta help install` for
details and more options.
I would expect this to (and I'm pretty sure it used to) instead print the user's defaults. I'm guessing we accidentally short-circuit when there's no volta key locally.
From what I can tell looking at the history of toolchain.rs, I don't believe this ever worked in this scenario. It looks like the code in Lookup::active_tool is attempting to duplicate the logic that volta_core uses to determine the project platform.
A short-term fix for this would be to make this logic aware of the fact that the project platform may not contain all of the tools, and fall-back to the default if it can't find it for any reason in the project.
Long-term, since we now store the Source per-tool in Platform, it probably makes sense to pull the platform information from Platform::current in the same way that the shims do. That way we can be confident that we are always getting the same information and not duplicating the behavior.
Curious! I must have missed this scenario in my tests originally鈥攎akes some sense; I was worried about making sure partial platforms resolved correctly, but never tried the no platform scenario it seems.
I think we also talked about merging those bits of source information originally, but the Platform-side wasn't ready (and wouldn't be for a while), so didn't pursue it. If I get some time, I'll push this forward!
Not sure if I'm facing this same issue. I uninstalled all prior node, npm, npm global packages before installing volta via:
$ curl https://get.volta.sh | bash
And then installed latest stable LTS node by running:
$ volta install node@12
But when I run volta list, it says 鈿★笍 No Node runtimes installed!.
$ volta list
鈿★笍 No Node runtimes installed!
You can install a runtime by running `volta install node`. See `volta help install` for
details and more options.
But when I run volta list all, it outputs this
$ volta list all
鈿★笍 User toolchain:
Node runtimes:
v12.18.3
Package managers:
Packages:
@cloudflare/[email protected] (default)
binary tools: wrangler
platform:
runtime: [email protected]
package manager: npm@built-in
If no node runtimes are installed then why does the all option shows node runtimes? Or maybe, I got tripped by the error messages. I'm on [email protected].
@detj The "No Node Runtimes Installed" message is almost definitely this issue. volta list all Correctly shows everything, it is only a problem with the "current" output of volta list that is showing the wrong behavior.
Created #926 to clean this up. As an additional note: While it would be ideal to avoid duplicating the logic, I don't see a clear path to doing that at the moment. The main reason is that the Platform::current logic is approaching the problem from "What tools should we use and what are their source?", while the volta list logic is asking "_Given_ a version, which platforms is it a part of, if any?"
Those two questions are related, but not exactly the same, so I don't see a clear way to re-use logic for both queries. The only place that it might be possible is in the Toolchain::active constructor, which _is_ trying to ask the same question as Platform::current
I encountered this while working on node core. Since node's test suite requires no unexpected package.json exist above it, it cannot work with volta at the moment.
Hi @bmeck, can you expand a little more on that issue? It's not immediately clear to me how issues with volta list would impact Node core.
@charlespierce basically, was using volta in some projects to test it out. In order to land a PR in node a utility called git-node is used. I installed it via volta using npm -g i node-core-utils. However, volta gets confused somehow when I'm in /node which doesn't have a package.json listing engines to use and cannot have one above it due to the test suite. This means that the shim gets confused it seems. I see git-node in volta which but not in ~/.volta/bin. I think this is due to the lack of figuring out the current engine?
Ah, got it! I think that's actually a separate issue, I opened #937 to track that, would you mind adding the error message / terminal output to that issue? This issue is specifically about volta list not matching the resolution that Volta (correctly) handles when you execute a tool, so it's more of a display bug than a fundamental issue with how Volta works.
Most helpful comment
@detj The "No Node Runtimes Installed" message is almost definitely this issue.
volta list allCorrectly shows everything, it is only a problem with the "current" output ofvolta listthat is showing the wrong behavior.