volta
volta copied to clipboard
nx migrate fails
It started about a month, or so, ago. Not sure why. When I try to update the NX mono repo version, it reports that it cannot determine where the NX binary is. However, I also have the NX installed locally, with the repo, and when I run NX commands, they work.
What gives?
➜ Frontends git:(master) ✗ nx migrate 17.1.3
/bin/sh: 1: /tmp/tmp-51775-oQQO0HPa2Xs5/node_modules/.bin/nx: not found
Command failed: /tmp/tmp-51775-oQQO0HPa2Xs5/node_modules/.bin/nx _migrate 17.1.3
➜ Frontends git:(master) volta install nx
success: installed [email protected] with executables: nx, nx-cloud
➜ Frontends git:(master) nx migrate 17.1.3
/bin/sh: 1: /tmp/tmp-52546-6au6LzxZEnVk/node_modules/.bin/nx: not found
Command failed: /tmp/tmp-52546-6au6LzxZEnVk/node_modules/.bin/nx _migrate 17.1.3
➜ Frontends git:(master) nx --version
Nx Version:
- Local: v17.0.1
- Global: Not found
I have created a ticket with NX more than a month ago, but no solution was provided there: https://github.com/nrwl/nx/issues/19899
Can you reproduce this with nx
when not using Volta, for example in a fresh shell where you have removed Volta from the PATH
and using another installation of Node?
I have not, and at the moment no time for it, but I'll check it in the upcoming days, and report back.
When I tested it with a plain NodeJs installation, without Volta, it worked like a charm.
Also, a thing I think worth mentioning, I believe that there might be a difference if yarn
or npm
is being used.
My repos with yarn
wouldn't work, but a new repo with npm
did work.
Thank you for following up here! I will see if I can reproduce (probably early next week). The /tmp
bits are suspicious; what do which nx
(should be Volta's shim) and volta which nx
(should be an actual path) say? 🤔
Under the plain NodeJs installation:
which nx
- /home/.../my-home/Downloads/node-v21.5.0-linux-x64/bin/nx
I've switched back to Volta and it's not working, again.
Under Volta:
which nx
- /home/.../my-home/.volta/bin/nx
volta which nx
- /home/.../my-home/www/my-app/node_modules/.bin/nx
I definitely think it’s related to Volta, to be clear – I’m just trying to figure out how to gather enough info to figure out why! 😅 Those paths look reasonable, and certainly are less confusing/odd than the original /tmp
paths. 🤔 Can you run with VOLTA_LOGLEVEL=debug RUST_BACKTRACE=full
? There don’t seem to be any crashes, so the backtrace is less likely to be interesting, but this will get us a bunch more info about what Volta itself is doing. It’s possible this is related to how nx
is managing its binaries and how that intersects with Volta’s global/user-default toolchain management.
Sure thing:
VOLTA_LOGLEVEL=debug RUST_BACKTRACE=full nx migrate latest
[verbose] Found nx in project at '/home/.../my-home/www/my-project/node_modules/.bin/nx'
[verbose] Found default configuration at '/home/.../my-home/.volta/tools/user/platform.json'
[verbose] [email protected] has already been fetched, skipping download
[verbose] [email protected] has already been fetched, skipping download
[verbose] Active Image:
Node: 18.19.0 from project configuration
npm: 10.2.3 from project configuration
pnpm: None
Yarn: 3.7.0 from project configuration
/bin/sh: 1: /tmp/tmp-96476-qZYOvCmO3Ocl/node_modules/.bin/nx: not found
Command failed: /tmp/tmp-96476-qZYOvCmO3Ocl/node_modules/.bin/nx _migrate latest
[verbose] No custom hooks found
Hi @chriskrycho , any news on this topic?
At the moment, I am forced to reconfigure my nodejs path each time I need to update the dependencies (NX and the related ones), which is bothersome.
Is there any progress here?
:(
It's been quite a while, now. Will this ever see light of day?
Same. I have to remove volta, run, the reinstall.