Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.3K
Visualizações
Angular 12 - Uncaught TypeError: Cannot read properties of undefined (reading 'ngModule') at isModuleWithProviders
core.js:27296 Uncaught TypeError: Cannot read properties of undefined (reading 'ngModule')
    at isModuleWithProviders (core.js:27296)
    at expandModuleWithProviders (core.js:27290)
    at Array.map (<anonymous>)
    at Function.get (core.js:26927)
    at getNgModuleDef (core.js:1117)
    at assertNgModuleType (core.js:1296)
    at compileNgModuleFactory__POST_R3__ (core.js:29073)
    at PlatformRef.bootstrapModule (core.js:29324)
    at Module.14431 (main.ts:11)
    at __webpack_require__ (bootstrap:19)

I have a custom library that is consumed by the main project (app). Everything was fine until I updated the project to Angular 12.

I followed the update instructions here, for both the main project and the custom library

There are no compile errors when I serve and no build errors when I build with --prod flag. However, when I try to assess the app locally from the browser I get the above error.

I have tried debugging it. That led me to these solutions, here and here. With those, I was able to trace the error to the modules imported from the custom library. But that's where I'm stuck.

Please, can someone assist with how to fix the error and run the app?

App.module

import { UtilsModule } from '@utils/utils.module';
import { PipesModule } from '@pipes/pipes.module';

...

@NgModule({
    imports: [
        BrowserModule,
    ...
        PipesModule,
        UtilsModule
    ]
})

tsconfig.json

{
"paths": {
      ...
      "@pipes/*": [
        "./node_modules/custom-library/src/pipes/*"
      ],
      "@utils/*": [
        "./node_modules/custom-library/src/utils/*"
      ],
     ...
   }
 ...
 }

package.json

{
 ...
 "dependencies": {
     ...
     "custom-library": "url-to-repository-branch"
     ...
   }
 ...
}

The library was installed with this approach here

over 4 years ago · Santiago Trujillo
1 Respostas
Responde à pergunta

0

I have spent the whole day looking for a solution to your problem(which was also my). Lets see if what I've found helps you.

Explaining the problem:

I have several non-published angular libraries and I want to use them in a project we are developing.

During the development phase, everything was fine (I Used tsconfig.json for configuring the path for the libraries). Yet, on deploy, that information was lost.

The solution was:

  • Create a build from the libraries (npm build PROJECT_LIBRARY)
  • Create a package from that new folder (npm package ./FOLDER_OF_BUILT_LIBRARY)
    • It's important that the package must be done from the BUILT Library and not the original code
  • Npm Install that library, based on a file:
    • "library-to-import"file:/./tmp/library-to-import.0.0.1.tgz"

And after that, use normally. I got it working (using angular v12)

over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda