nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.28k stars 2.32k forks source link

Can't use `nx migrate latest` with pnpm@latest and pnpm workspace #11276

Closed Tirke closed 2 years ago

Tirke commented 2 years ago

Current Behavior

pnpm nx migrate latest no longer works on pnpm@7.5.2. Using NX_MIGRATE_USE_LOCAL=true can bypass the issue.

Expected Behavior

pnpm nx migrate works without using NX_MIGRATE_USE_LOCAL=true

Steps to Reproduce

Run pnpm nx migrate latest while using node 16.16 and pnpm 7.5.2. Command will fail with the error message ERROR  --workspace-root may only be used inside a workspace Searched a bit the reason why it was failing (this is how I found about NX_MIGRATE_USE_LOCAL) migrate seems to work in a temp directory that is not recognized as a workspace thus the error message. Maybe new pnpm version are less lenient on using -w outside workspaces?

Failure Logs

❯ pnx migrate latest
Fetching meta data about packages.
It may take a few minutes.
Fetching nx@14.4.3
Fetching nx@latest

 ERROR  The migrate command failed.

 >  NX   Command failed: pnpm add -w nx@latest

    ERROR  --workspace-root may only be used inside a workspace

   Pass --verbose to see the stacktrace.

Command failed: /var/folders/dn/zfmw02m54f125nx0sbdpmc6w0000gn/T/tmp-5153-9y0N2TfjZ0nN/node_modules/.bin/nx _migrate latest

Environment

❯ pnx report

 >  NX   Report complete - copy this into the issue template

   Node : 16.16.0
   OS   : darwin arm64
   pnpm : 7.5.2

   nx : 14.4.0
   @nrwl/angular : Not Found
   @nrwl/cypress : 14.4.0
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.4.0
   @nrwl/eslint-plugin-nx : 14.4.0
   @nrwl/express : Not Found
   @nrwl/jest : 14.4.0
   @nrwl/js : 14.4.0
   @nrwl/linter : 14.4.0
   @nrwl/nest : 14.4.0
   @nrwl/next : 14.4.2
   @nrwl/node : 14.4.0
   @nrwl/nx-cloud : 14.2.0
   @nrwl/nx-plugin : Not Found
   @nrwl/react : 14.4.0
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.4.0
   @nrwl/web : 14.4.0
   @nrwl/workspace : 14.4.0
   typescript : 4.7.4
   ---------------------------------------
   Community plugins:
olexiyb commented 2 years ago

the same issue on Ubuntu 20.04

$ nx migrate latest --verbose
Fetching meta data about packages.
It may take a few minutes.
Fetching nx@14.4.3
Fetching nx@latest

 ERROR  The migrate command failed.

 >  NX   Command failed: pnpm add -w nx@latest

Error: Command failed: pnpm add -w nx@latest

    at ChildProcess.exithandler (node:child_process:398:12)
    at ChildProcess.emit (node:events:527:28)
    at maybeClose (node:internal/child_process:1092:16)
    at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
Command failed: /tmp/tmp-403302-CeSYul2JZRPk/node_modules/.bin/nx _migrate latest --verbose
$ nx report

 >  NX   Report complete - copy this into the issue template

   Node : 16.15.1
   OS   : linux x64
   pnpm : 7.1.2

   nx : 14.4.2
   @nrwl/angular : Not Found
   @nrwl/cypress : Not Found
   @nrwl/detox : Not Found
   @nrwl/devkit : 12.6.2
   @nrwl/eslint-plugin-nx : 14.4.2
   @nrwl/express : 12.6.2
   @nrwl/jest : 14.4.2
   @nrwl/js : 14.4.2
   @nrwl/linter : 14.4.2
   @nrwl/nest : 14.4.2
   @nrwl/next : Not Found
   @nrwl/node : 14.4.2
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : Not Found
   @nrwl/workspace : 14.4.2
   typescript : 4.7.4
FrozenPandaz commented 2 years ago

I tried to reproduce this and wasn't able to:

jason@pop-os ~/p/nx-examples (master)> pnpm nx migrate latest

> nx-example@0.0.0 nx /home/jason/projects/nx-examples
> nx "migrate" "latest"

Fetching meta data about packages.
It may take a few minutes.
Fetching nx@14.5.1
Fetching nx@latest

>  NX  The migrate command has run successfully.

- package.json has been updated
- there are no migrations to run, so migrations.json has not been created.

>  NX  Next steps:

- Make sure package.json changes make sense and then run 'pnpm install --no-frozen-lockfile'
- To learn more go to https://nx.dev/using-nx/updating-nx

Could you please retry with the latest version? We JUST merged some changes recently that might fix the issue you are seeing.

olexiyb commented 2 years ago

Just verified upgrade worked to latest 14.5.1 version

Tirke commented 2 years ago

Also working on my side, closing.

github-actions[bot] commented 1 year ago

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.