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

All Nx cli commands fail on 13.9 #9359

Closed
manan-jadhav opened this issue Mar 16, 2022 · 21 comments · Fixed by #10148
Closed

All Nx cli commands fail on 13.9 #9359

manan-jadhav opened this issue Mar 16, 2022 · 21 comments · Fixed by #10148

Comments

@manan-jadhav
Copy link

manan-jadhav commented Mar 16, 2022

Current Behavior

All NX cli commands fail for me with no output, even --help.

Expected Behavior

Nx cli commands should work - at least --help should.

This started to happen since yesterday, giving me the hint that this might be a regression in 13.9

Steps to Reproduce

I already had a monorepo - so I ran this command according to docs:
npx add-nx-to-monorepo

I've done this multiple times, after switching to a clean branch and clearing node_modules, and running npm install.

When I pin the @nrwl/* versions to 13.8, it works fine.

Failure Logs

Nx commands return nothing except a non-zero return code. Stdout / stderr is completely empty, even for npx nx

Environment

Node : 14.17.5
OS : darwin x64
npm : 6.14.14

The following version gives me this error:

"@nrwl/cli": "latest",
"@nrwl/tao": "latest",
"@nrwl/workspace": "latest",
@LuckeeDev
Copy link

I'm having the same issue migrating from 13.8.8 to 13.9.0. The command nx migrate latest takes forever and doesn't output anything.

@andynunes
Copy link

@LuckeeDev See #9345, fixed in 13.9.1, which was just now released. You will want to restart your computer, as you are slowly being fork bombed.

@andynunes
Copy link

Although the actual issue you're reporting might not be fixed in 13.9.1, as I'm now getting:

Unexpected error:
Error: Cannot find module 'nx/src/cli/run-cli.js'

@FrozenPandaz
Copy link
Collaborator

Hi @manan-jadhav is it possible for you to point me to a repo somewhere after running npx add-nx-to-monorepo?

I am unable to reproduce this issue.

@jahumes
Copy link

jahumes commented Mar 16, 2022

I am wondering if this is related to #9346

@LuckeeDev
Copy link

@andynunes it worked, thanks a lot!

@manan-jadhav
Copy link
Author

manan-jadhav commented Mar 17, 2022

Update: After updating to 13.9.2, I now see the warning Please update your global Nx but after that the command exits and keep doing the same thing as before.

@manan-jadhav
Copy link
Author

manan-jadhav commented Mar 17, 2022

Update: I think I understand what happened:

  • I added Nx to my monorepo when the latest version was 13.8.8 (using npx add-nx-to-monorepo)
  • Next day, I ran npm install after merging in another dev's work that lead to package-lock.json getting updated, and my version getting updated to 13.9.x (I'm not sure if 13.9.0 or 13.9.1)
  • At this point, require('nx/bin/nx') in my node_modules/.bin/nx started to fail silently because of @nrwl/cli being removed in 13.9.1. I don't know why it didn't throw a Module not found.
  • I started seeing the warning message a few hours ago when 13.9.2 was released.

@manan-jadhav
Copy link
Author

@FrozenPandaz Steps to reproduce:

  1. Use npx add-nx-to-monorepo to add Nx to a monorepo
  2. Nx cli commands won't work after this.

npx add-nx-to-monorepo does not add "nx": "latest" to my package.json, which is the root of the problem.

There is no point in sharing a repro repo because this is an issue with npx add-nx-to-monorepo and 13.9.0 together.

When 13.8.x was latest, add-nx-to-workspace worked fine.

I'm going to make an issue report on that project too.

@junzhengca
Copy link

Not sure if this helps. I recently ran the migration utility to migrate from nx 13.4.1 to latest, but for some reason, nx did not automatically update the version of @nrwl/cli.

Simply changing the @nrwl/cli version to match others fixed the issue.

@viceice
Copy link
Contributor

viceice commented Mar 22, 2022

Seeing the same when upgrading from 13.8.x.

repro

> npx create-nx-workspace@latest --preset angular --cli angular nx-v13
√ Application name                    · test-app
√ Default stylesheet format           · scss
√ Use Nx Cloud? (It's free and doesn't require registration.) · No
> cd .\nx-v13\
> npm run update
> npm install --legacy-peer-deps
> npx nx migrate --run-migrations

Checkout package.json before and after npx nx migrate --run-migrations and you see the issue.

@viceice
Copy link
Contributor

viceice commented Mar 22, 2022

Should @nrwl/cli removed from package.json or updated?

@manan-jadhav
Copy link
Author

removing @nrwl/cli and replacing with nx worked for me

@shayll-herolo
Copy link

can confirm on 13.9.4, uninstalling @nrwl/cli and installing nx worked for me.
npm uninstall -D @nrwl/cli
npm install -D nx
I can run all nx commands now

@viceice
Copy link
Contributor

viceice commented Mar 23, 2022

the nx package was there after migration and @nrwl/tao was also removed. It seeems the migration code missed the @nrwl/cli

@JoA-MoS
Copy link
Contributor

JoA-MoS commented Mar 24, 2022

I can confirm that @nrwl/cli was not updated in the migration step and uninstalling @nrwl/cli and install nx solved the issue.

This is also the case for the global package. Could we update the error messging to indicate that you need to uninstall @nrwl/cli

Please update your global install of Nx
- npm install -g nx
> If you had previously installed the nx cli using the @nrwl/cli package uninstall this and install using the nx package
- npm uninstall -g @nrwl/cli
- npm install -g nx

@vltansky
Copy link

manual updated @nrwl/cli to version 13.9.4 solved it for me.
npm i @nrwl/cli@13.9.4 -D

@ThomasBurleson
Copy link
Contributor

Definitely the migration scripts should account for this.

@github-actions
Copy link

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@github-actions github-actions bot added the stale label Apr 15, 2022
@BensonBen
Copy link

recently bumped into this issue. I used @shayll-herolo 's solution which allowed me use cli commands locally.
I reverted to a previous version of my project using git reset --hard someCommitHash then using nx migrate latest tried to bypass bad versions. Whatever migrations wasn't working before still isn't working

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.