Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nx migrate latest does not work with pnpm #28991

Open
1 of 4 tasks
kasir-barati opened this issue Nov 19, 2024 · 4 comments
Open
1 of 4 tasks

nx migrate latest does not work with pnpm #28991

kasir-barati opened this issue Nov 19, 2024 · 4 comments
Assignees
Labels
scope: core core nx functionality type: bug

Comments

@kasir-barati
Copy link

kasir-barati commented Nov 19, 2024

Current Behavior

I first thought it is a question, thus I asked it here. But as you can see there this nx upgrade latest does not work for me at all.

I am using pnpm and even if I switch back to npm for a sec to update nx it and switch back to pnpm it does not work.

So to sum it up, we have two issues:

  1. When using pnpm the nx migrate latest does nothing except updating you nx.json and you package.json stays untouched. No migrations.json too.

  2. When I switch to npm for a quick check it does update package.json and nx.json which is not entirely desirable (I mean I want it to work with pnpm and I should not have to switch my package manager to just get it to work) but still it fails to create a migrations.json file.

    Though in your doc you're saing "A migrations.json being generated if there are pending migrations.", which I guess meant to say if it was not generated then you do not need it. Thus I guess I am fine on that part.

    But the issue is when I try then to run nx serve hello-world. It fails to run it when I switch back to pnpm. Note that it does work if I stay with npm. But I do not wanna.

Expected Behavior

Just migrate it.

GitHub Repo

https://github.com/kasir-barati/graphql

Steps to Reproduce

  1. pnpm i.
  2. nx migrate latest.

And then you can see that it does not even bother updating my package.json

  1. rm -rf node_modules tmp dist .nx.
  2. rm pnpm-lock.yaml.
  3. npm i.
  4. nx migrate latest.
  5. npm i.
  6. nx serve hello-world.
  7. You should see some logs in your terminal. It is not doing anything fancy and it is not even a webserver, so it does exit afterward.
  8. rm package-lock.json.
  9. rm -rf node_modules tmp dist .nx
  10. pnpm i.
  11. nx serve hello-world.
  12. It breaks with this log:
 NX   Daemon process terminated and closed the connection

Please rerun the command, which will restart the daemon.
If you get this error again, check for any errors in the daemon process logs found in: /home/kasir/projects/graphql/.nx/workspace-data/d/daemon.log

And then here is what is logged in that file:

https://pastebin.com/GAmP4ctH

It was really long, so I decided to upload it in pastebin.

BTW nx reset did not help.

Nx Report

It seems as if Nx's cli is entirely crashed. this command also generates the same log:

nx report

 NX   Daemon process terminated and closed the connection

Please rerun the command, which will restart the daemon.
If you get this error again, check for any errors in the daemon process logs found in: /home/kasir/projects/graphql/.nx/workspace-data/d/daemon.log

And here is what it logged in that file: https://pastebin.com/fWm2fQ05

Again, too long to be pasted here IMO thus it is pasted in pastebin.

Failure Logs

All logs were provided in previous steps

Package Manager Version

pnpm:9.6.0

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

No response

@kasir-barati
Copy link
Author

JFYI: I also tried to update my packages to latest since most of the times nx generators does install versions that ain't latest. So I keep them up to date with pnpm. But pnpm update --latest will update everything in my package.json including @nx/* which is not desirable at all. But at the same time when you say skip any lib starting with @nx/* it throws this error.

Now I feel my issue is turning from a simple issue to a chicken and egg problem ♾.

@kasir-barati
Copy link
Author

Please lemme know if you are agreeing with me on the main topic of this being an issue in the first place. I am asking this since this silence is kinda really confusing, does this mean that:

  • This is a well known issue, but not something that you wanna fix ATM, if not please close this issue so we know that Nx does not have any plan to support pnpm.
  • If this is no an issue provide solution for this problem in your doc since its absence is leading to a lot of problems.
  • If this is an issue, let us know that it has been added to the backlog.

@kasir-barati
Copy link
Author

Just for other devs who might end up in this page, ATM Nx does not support pnpm. I was just following their doc on converting an existing project to use Nx but I got busted since it did not convert my package.json scripts as it should. And the reason was because of pnpm 🥲.

@kasir-barati
Copy link
Author

I am perplexed now, right now I used nx migrate latest in my monorepo (another repo entirely) and it worked 🥇 😲 🤔 . IDK anymore what's going on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: core core nx functionality type: bug
Projects
None yet
Development

No branches or pull requests

3 participants