MichaelEvanchik
MichaelEvanchik

Reputation: 1766

Angular project produces javascript error "core.js:23018 Uncaught TypeError: Cannot read properties of undefined (reading 'id')"

No changes have been made to the project, since it last compiled except for upgrading VSCode Node: 16.13.0

I am now on 1.68.1 VSCode Angular 8.3.1 is output of -v

the exact error is above. When debugging through the section it points to, it goes through imports: [, and it complains about LoadingBarHttpClientModule, and LoadingBarRouterModule, i remove those, but then complains about NgxsRootModule , so i give up at this point, not removing that.

in core.js this is the code where it will break in console

function registerNgModuleType(ngModuleType) {
    if (ngModuleType.ngModuleDef.id !== null) {

nothing

Also ever since my development machine was created, i cannot get ng new "commands" to run to create components or modules

If i do Windows Script Host pops up saying

\AppData\Roaming\npm\node_modules@aungular\cli\bin\ng.js line 1 char 1 invalid character

What gives

Upvotes: 0

Views: 342

Answers (1)

onrails
onrails

Reputation: 849

I think there is a dependency-version mismatch. You need to

1- Go to C:\Users\${your_user_name_here}\AppData\Roaming\npm and remove content manually if you are on Windows

2- Run npm ci to reinstall clean version packages

Also, you can follow this thread here since the same issue has been resolved similarly

Upvotes: 1

Related Questions