Schniz / fnm

๐Ÿš€ Fast and simple Node.js version manager, built in Rust
https://fnm.vercel.app
GNU General Public License v3.0
17.41k stars 441 forks source link

fnm is incompatible with turborepo cli when using --parallel flag #833

Open felskov opened 1 year ago

felskov commented 1 year ago

Yesterday we experienced som issues when using turborepo cli, which we originally reported as bug with turborepo. As it turned out however, this is actually an issue that happens when using fnm.

If you look at the original bug report here: https://github.com/vercel/turborepo/issues/2221

There are steps to reproduce the issue specifically. When using fnm and following the steps described there, the issues with conflicting commands occur. When running with node installed for instance through homebrew, the issues does not happen.

Is there some race condition that can occur with fnm, when turborepo dispatches the two distinct scripts in rapid succession?

Note that we later found out, that this issue is not tied to the use of --use-on-cd, it will always happen if using fnm to run node.

byjokese commented 1 year ago

So then the problem is that you are switching to a none desired node version when changing folder? Or even failing to do so on changing folder?

felskov commented 1 year ago

Maybe, I don't know the internals in turbo and how this works. The repo does however contain a .node-version at the root-level, and I've configured my environment with fnm env --use-on-cd --version-file-strategy=recursive, so the same node version ought to be selected for all packages within the repo.

Schniz commented 1 year ago

I use turborepo for all my projects, and use fnm with the recursive use-on-cd I donโ€™t really understand the issue. Please add a repo and script to reproduce ๐Ÿ™

felskov commented 1 year ago

@Schniz I don't have a repo containing the issue per say, as it happened within a private repo and we've since worked around the issue. There is a step-by-step copy+paste files to reproduce on the issue linked:

https://github.com/vercel/turbo/issues/2221

But as I'm not experiencing it myself anymore it's not a prioritized issue for us - feel free to close if it's too much of a bother to track it down :)