angularnrwl-nx

NX Cannot read properties of undefined (reading 'endsWith')


After upgrading my Angular frontend to Angular 14 and upgrading both @nrwl/angular and @nrwl/cli devDependencies both to version 14.6.4, I get the following error in terminal when I run yarn start

NX Cannot read properties of undefined (reading 'endsWith')

I then decided to run nx migrate --run-migrations

and I got:

NX Failed to run update-ngcc-postinstall from @nrwl/angular. This workspace is NOT up to date!

NX rule is not a function

So I set @angular/cli to version 14.2.1 and @nrwl/cli to 14.6.4.

I ran yarn again, then yarn start and I still get the same error.


Solution

  • Try

    nx migrate @nrwl/workspace@version
    

    Where version should be replaced with proper value

    And refer this link to find the matching nx version

    https://nx.dev/angular-nx-version-matrix

    Finally run

    nx migrate --run-migrations
    

    Read for nx migrations

    https://nx.dev/core-features/automate-updating-dependencies