question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"XX.ngfactory.js is missing from the TypeScript compilation" when ng build

See original GitHub issue

I build my project use ng build --prod.

throw these error:

ERROR in ./node_modules/_@ng-bootstrap_ng-bootstrap@1.1.1@@ng-bootstrap/ng-bootstrap/alert/alert.ngfactory.js
Module build failed: Error: D:\Angular\video-server\node_modules\_@ng-bootstrap_ng-bootstrap@1.1.1@@ng-bootstrap\ng-bootstrap\alert\alert.ngfactory.js is missing from the TypeScript
 compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library reposit
ory to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).
    at AngularCompilerPlugin.getCompiledFile (D:\Angular\video-server\node_modules\_@ngtools_webpack@1.9.5@@ngtools\webpack\src\angular_compiler_plugin.js:656:23)
    at plugin.done.then (D:\Angular\video-server\node_modules\_@ngtools_webpack@1.9.5@@ngtools\webpack\src\loader.js:467:39)
 @ ./src/app/app.module.ngfactory.js 12:0-90
 @ ./src/main.ts
 @ multi ./src/main.ts

Also there are popover.ngfactory.js, modal-window.ngfactory.js …

And my tsconfig.json:

{
  "compileOnSave": false,
  "compilerOptions": {
    "outDir": "./dist/out-tsc",
    "baseUrl": "src",
    "sourceMap": true,
    "declaration": false,
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2016",
      "dom"
    ]
  }
}

Version: angular-cli: 1.6.5 angular: ^5.2.0 ng-bootstrap: 1.1.1

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
JulioJucommented, Jun 5, 2018

@RajPack, I’ve tested, but doesn’t t work. As JHipster use Angular 6, the syntax is a little bit different that you said. The syntax should be instead (see https://github.com/angular/angular-cli/issues/10896 and https://github.com/angular/angular-cli/wiki/angular-workspace) :

"architect": {
  "build": {
    "builder": "@angular-devkit/build-angular:browser",
    "options": {
      "preserveSymlinks": true
    }
  }
}

As the problem is with command ./mvn verify (trigger packaging of the application), I’ve tried also with https://webpack.js.org/configuration/resolve/#resolve-symlinks, without more success. Have you an idea ?

It’s strange, because some of ngx-bootstrap modules are founded, like :

[INFO]  [67] ../node_modules-cache-angular-sample/node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker.module.js + 7 modules 39.1 KiB {1} [built]
[INFO]       |    8 modules
[INFO]  [82] ../node_modules-cache-angular-sample/node_modules/@ng-bootstrap/ng-bootstrap/accordion/accordion.module.js + 1 modules 8.5 KiB {1} [built]
[INFO]       |    2 modules
[INFO]  [83] ../node_modules-cache-angular-sample/node_modules/@ng-bootstrap/ng-bootstrap/tabset/tabset.module.js + 1 modules 8.3 KiB {1} [built]
[INFO]       |    2 modules
[INFO]  [93] ../node_modules-cache-angular-sample/node_modules/@ng-bootstrap/ng-bootstrap/carousel/carousel.module.js + 1 modules 9.79 KiB {1} [built]
[INFO]       |    2 modules
[INFO]  [94] ../node_modules-cache-angular-sample/node_modules/@ng-bootstrap/ng-bootstrap/typeahead/typeahead.module.js + 3 modules 20.1 KiB {1} [built]
[INFO]       |    4 modules
[INFO]  [96] ../node_modules-cache-angular-sample/node_modules/@ng-bootstrap/ng-bootstrap/tooltip/tooltip.module.js + 1 modules 10.1 KiB {1} [built]
[INFO]       |    2 modules
[INFO]       [] 274859ms -> [] 7438ms -> [0] 8302ms -> [310] 10565ms -> [305] 147ms -> factory:15330ms building:616ms dependencies:1969ms = 319226ms
[INFO] [101] ../node_modules-cache-angular-sample/node_modules/@ng-bootstrap/ng-bootstrap/popover/popover.module.js + 1 modules 10 KiB {1} [built]
[INFO]       |    2 modules

But not :

[INFO] ERROR in ../node_modules-cache-angular-sample/node_modules/@ng-bootstrap/ng-bootstrap/alert/alert.ngfactory.js
[INFO] ERROR in ../node_modules-cache-angular-sample/node_modules/@ng-bootstrap/ng-bootstrap/datepicker/datepicker.ngfactory.js
[INFO] ERROR in ../node_modules-cache-angular-sample/node_modules/@ng-bootstrap/ng-bootstrap/modal/modal-backdrop.ngfactory.js
[INFO] ERROR in ../node_modules-cache-angular-sample/node_modules/@ng-bootstrap/ng-bootstrap/modal/modal-window.ngfactory.js
[INFO] ERROR in ../node_modules-cache-angular-sample/node_modules/@ng-bootstrap/ng-bootstrap/pagination/pagination.ngfactory.js
[INFO] ERROR in ../node_modules-cache-angular-sample/node_modules/@ng-bootstrap/ng-bootstrap/popover/popover.ngfactory.js
[INFO] ERROR in ../node_modules-cache-angular-sample/node_modules/@ng-bootstrap/ng-bootstrap/progressbar/progressbar.ngfactory.js
[INFO] ERROR in ../node_modules-cache-angular-sample/node_modules/@ng-bootstrap/ng-bootstrap/tooltip/tooltip.ngfactory.js
[INFO] ERROR in ../node_modules-cache-angular-sample/node_modules/@ng-bootstrap/ng-bootstrap/typeahead/typeahead-window.ngfactory.js

Please, what do you think about that @pkozlowski-opensource ?

1reaction
bcmedeiroscommented, Oct 4, 2018

I’m getting this using cli 7.0.0.rc.0:

error	04-Oct-2018 08:56:18	
error	04-Oct-2018 08:56:18	ERROR in ./node_modules/@ng-bootstrap/ng-bootstrap/alert/alert.ngfactory.js
error	04-Oct-2018 08:56:18	Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
error	04-Oct-2018 08:56:18	Error: E:\app\node_modules\@ng-bootstrap\ng-bootstrap\alert\alert.ngfactory.js is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
error	04-Oct-2018 08:56:18	The missing file seems to be part of a third party library. TS files in published libraries are often a sign of a badly packaged library. Please open an issue in the library repository to alert its author and ask them to package the library using the Angular Package Format (https://goo.gl/jB3GVv).
error	04-Oct-2018 08:56:18	    at AngularCompilerPlugin.getCompiledFile (E:\app\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:743:23)
error	04-Oct-2018 08:56:18	    at plugin.done.then (E:\app\node_modules\@ngtools\webpack\src\loader.js:41:31)
error	04-Oct-2018 08:56:18	    at process._tickCallback (internal/process/next_tick.js:68:7)

Can it be related? Should I open a new issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

ts is missing from the TypeScript compilation. Please make ...
The @wtw folder is under the node_modules folder. The child project was building the parent package fine when it was in Angular version...
Read more >
angular/angular-cli - Gitter
when I try to run ng build --prod. I am getting below error. *This version of CLI is only compatible with angular version...
Read more >
Angular: Writing AoT-friendly applications | by David - Medium
First, the compiler generates factory code in TypeScript and then compiles both the *.ngfactory.ts and *.component.ts files to JavaScript. This means that the ......
Read more >
Build Angular Like An Architect (Part 1) - DEV Community ‍ ‍
Builders enable you to code custom builds with TypeScript and RxJS ... At ng-conf 2017 the Angular team announced the AOT compiler is ......
Read more >
ng build ignore warnings | The AI Search Engine You Control
ng build --prod --aot=false. I would get will return a error similar to. Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory'.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found