nx: Upgraded from Nx 10.1 to 10.4: Now getting "Could not find Nx modules in this workspace."

Current Behavior

Since upgrading my Nx from version 10.1 to 10.4 just now, I can no longer start my project. It says, “NX ERROR Could not find Nx modules in this workspace.” Followed by, “Have you run npm/yarn install?”

Expected Behavior

I would expect my project to start. It starts fine on the older version.

Steps to Reproduce

Presumably, this would happen for anyone running a TypeScript React project upgrading to 10.4?

Environment

Oddly enough, even nx report is throwing the same error listed above.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 4
  • Comments: 25 (3 by maintainers)

Most upvoted comments

I had the same problem after migration to nx@12.10.0 in CI. Before migration there were no problems neither in docker nor on localhost. After migration localhost was working without issues but the error was shown in docker before linting.

For me the solution was to add @nrwl/cli to dev dependencies:

npm i -D @nrwl/cli

On localhost I had @nwrl/cli installed locally.

Another quick update: I was able to get past the error I posted just above.

Here’s what I ran most recently, in order to get past this error:

npm i -D @nrwl/cli
npm i -D @nrwl/angular
npx nx migrate --run-migrations=migrations.json

That seems to have allowed me to process the migrations file and update my Nx successfully to v10.3… With the exception, however, of the @nrwl/cli and @nrwl/angular packages, which are at 10.4 now.

OK. Thanks for getting back to me so quickly, @mandarini!

Unfortunately, following the upgrade path produced the same, undesirable result.

I first ran nx migrate @nrwl/workspace, as instructed. Next, I did an npm install as you recommended.

Following that, upon trying to run nx migrate --run-migrations=migrations.json, I got the same error. =(