Home > Back-end >  Angular project produces javascript error "core.js:23018 Uncaught TypeError: Cannot read proper
Angular project produces javascript error "core.js:23018 Uncaught TypeError: Cannot read proper

Time:08-09

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) {
  • i have tried to disable Angular Language Service but in this version there is no "checkbox" to do so, so i just went to extensions and disabled it.
  • deleted node_modules, and npm install
  • restored node_modules, and npm update
  • restored node_modules, and just run npm install

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

CodePudding user response:

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

  • Related