Daniel
Daniel

Reputation: 15433

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.

Upvotes: 3

Views: 9476

Answers (2)

Igor Kurkov
Igor Kurkov

Reputation: 5038

This NX error "read properties of undefined (reading 'endsWith')" in the console in 2025 can also appear if you remove app URLs from the manifest.json file.

Please check the missed URLs in the NX manifest file.

module-federation.manifest.json:

{
  "your-app": "https:your-domain:3000",
  "your-app-2": "localhost:3000",
}

its just an example of the paths, please check yours app paths first

this is the link to the docs about manifests in NX https://nx.dev/recipes/angular/dynamic-module-federation-with-angular

Upvotes: 0

Kelum Bandara
Kelum Bandara

Reputation: 478

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

Upvotes: 2

Related Questions