NX @nrwl/node generator error "Cannot find module 'nx/src/utils/code-frames"
Asked Answered
M

3

6

I am attempting to generate a new node project using @nrwl/node and when I use the generator I am met with the error

 NX   Cannot find module 'nx/src/utils/code-frames'

inhibiting me from running the generator.

my nx version is 15.2.1 my @nrwl/node version is 15.9.2 and my node version is 16.17.0

Ive attempted to reinstall the packages multiple times to no avail.

Maynard answered 10/4, 2023 at 16:57 Comment(0)
S
7

nx and @nrwl/node must be at the same version. You should see an error if you run nx workspace-lint (prior to its deprecation), or during nx report on newer versions.

nx migrate latest would get things synced back up.

Still answered 11/4, 2023 at 23:4 Comment(0)
H
3

Run nx report

You will get results like the following:

NX Some packages have misaligned versions! These packages should match your installed version of Nx.

Running nx migrate 15.9.3

Then Yarn or NPM i

The conflict will be solved

Hobbie answered 5/5, 2023 at 7:46 Comment(0)
M
1

For me I had

@nrwl/webpack": "^15.0.13" while all my other packages were without the ^ so like "@nrwl/webpack": "15.0.13"

Which the migrations thing did identify but didn't fix, so anyway check that your versions match not only in number but also in versioning scheme or whatever this is called

so basically i just had to remove the ^ from my webpack dep

Michalmichalak answered 18/9, 2023 at 12:2 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.