volta icon indicating copy to clipboard operation
volta copied to clipboard

nx migrate fails

Open nemonemi opened this issue 1 year ago • 12 comments

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

nemonemi avatar Dec 05 '23 13:12 nemonemi

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?

chriskrycho avatar Dec 19 '23 20:12 chriskrycho

I have not, and at the moment no time for it, but I'll check it in the upcoming days, and report back.

nemonemi avatar Jan 08 '24 13:01 nemonemi

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.

nemonemi avatar Jan 12 '24 13:01 nemonemi

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? 🤔

chriskrycho avatar Jan 12 '24 16:01 chriskrycho

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

nemonemi avatar Jan 16 '24 13:01 nemonemi

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.

chriskrycho avatar Jan 16 '24 15:01 chriskrycho

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

nemonemi avatar Jan 16 '24 15:01 nemonemi

Hi @chriskrycho , any news on this topic?

nemonemi avatar Jan 26 '24 09:01 nemonemi

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?

nemonemi avatar Feb 19 '24 09:02 nemonemi

:(

nemonemi avatar Mar 01 '24 11:03 nemonemi

It's been quite a while, now. Will this ever see light of day?

nemonemi avatar Apr 02 '24 07:04 nemonemi

Same. I have to remove volta, run, the reinstall.

youngcm2 avatar May 07 '24 17:05 youngcm2