nx: All Nx cli commands fail on 13.9

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",

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 7
  • Comments: 21 (5 by maintainers)

Most upvoted comments

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'

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

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.

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

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

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.

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.

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.

@LuckeeDev See https://github.com/nrwl/nx/issues/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.