error TS2694: Namespace r3_symbols has no exported member 'ɵɵFactoryDef'

733 views Asked by At

I have created angular library as per instructions given in official angular documentation. after building the library, using ng build my-lib, I linked locally using npm link command.

After this in my separate Ionic 5 project, I linked my newly created library by running command from the root folder: npm link my-lib

Till here everything was working fine and I was able to import and run the library into my Ionic 5 project successfully.

After this, I made some changes into my library project and ran ng build my-lib command to rebuild the project and it is giving me following error:

ng build my-lib 
Building Angular Package
Building entry point 'my-lib'
Compiling TypeScript sources through ngc

BUILD ERROR
node_modules/@angular/core/src/linker/compiler.d.ts(71,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/linker/compiler.d.ts(72,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/application_ref.d.ts(145,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/application_ref.d.ts(146,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/application_ref.d.ts(312,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/application_ref.d.ts(313,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/linker/system_js_ng_module_factory_loader.d.ts(39,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/linker/system_js_ng_module_factory_loader.d.ts(40,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/application_init.d.ts(29,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/application_init.d.ts(30,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/testability/testability.d.ts(90,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/testability/testability.d.ts(91,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/testability/testability.d.ts(134,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/testability/testability.d.ts(135,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/application_module.d.ts(32,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵNgModuleDefWithMeta'.
node_modules/@angular/core/src/application_module.d.ts(33,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectorDef'.
node_modules/@angular/core/src/console.d.ts(12,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/console.d.ts(13,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.

Error: node_modules/@angular/core/src/linker/compiler.d.ts(71,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/linker/compiler.d.ts(72,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/application_ref.d.ts(145,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/application_ref.d.ts(146,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/application_ref.d.ts(312,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/application_ref.d.ts(313,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/linker/system_js_ng_module_factory_loader.d.ts(39,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/linker/system_js_ng_module_factory_loader.d.ts(40,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/application_init.d.ts(29,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/application_init.d.ts(30,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/testability/testability.d.ts(90,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/testability/testability.d.ts(91,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/testability/testability.d.ts(134,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/testability/testability.d.ts(135,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/application_module.d.ts(32,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵNgModuleDefWithMeta'.
node_modules/@angular/core/src/application_module.d.ts(33,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectorDef'.
node_modules/@angular/core/src/console.d.ts(12,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/console.d.ts(13,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.

    at Object.<anonymous> (/Documents/project/frontend/my-workspace/node_modules/ng-packagr/lib/ngc/compile-source-files.js:65:19)
    at Generator.next (<anonymous>)
    at fulfilled (/Documents/project/frontend/my-workspace/node_modules/ng-packagr/lib/ngc/compile-source-files.js:4:58)

node_modules/@angular/core/src/linker/compiler.d.ts(71,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/linker/compiler.d.ts(72,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/application_ref.d.ts(145,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/application_ref.d.ts(146,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/application_ref.d.ts(312,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/application_ref.d.ts(313,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/linker/system_js_ng_module_factory_loader.d.ts(39,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/linker/system_js_ng_module_factory_loader.d.ts(40,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/application_init.d.ts(29,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/application_init.d.ts(30,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/testability/testability.d.ts(90,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/testability/testability.d.ts(91,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/testability/testability.d.ts(134,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/testability/testability.d.ts(135,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/application_module.d.ts(32,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵNgModuleDefWithMeta'.
node_modules/@angular/core/src/application_module.d.ts(33,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectorDef'.
node_modules/@angular/core/src/console.d.ts(12,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/console.d.ts(13,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.

Error: node_modules/@angular/core/src/linker/compiler.d.ts(71,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/linker/compiler.d.ts(72,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/application_ref.d.ts(145,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/application_ref.d.ts(146,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/application_ref.d.ts(312,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/application_ref.d.ts(313,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/linker/system_js_ng_module_factory_loader.d.ts(39,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/linker/system_js_ng_module_factory_loader.d.ts(40,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/application_init.d.ts(29,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/application_init.d.ts(30,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/testability/testability.d.ts(90,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/testability/testability.d.ts(91,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/testability/testability.d.ts(134,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/testability/testability.d.ts(135,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.
node_modules/@angular/core/src/application_module.d.ts(32,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵNgModuleDefWithMeta'.
node_modules/@angular/core/src/application_module.d.ts(33,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectorDef'.
node_modules/@angular/core/src/console.d.ts(12,25): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵFactoryDef'.
node_modules/@angular/core/src/console.d.ts(13,26): error TS2694: Namespace '"/Documents/project/frontend/my-workspace/node_modules/@angular/core/src/r3_symbols"' has no exported member 'ɵɵInjectableDef'.

    at Object.<anonymous> (/Documents/project/frontend/my-workspace/node_modules/ng-packagr/lib/ngc/compile-source-files.js:65:19)
    at Generator.next (<anonymous>)
    at fulfilled (/Documents/project/frontend/my-workspace/node_modules/ng-packagr/lib/ngc/compile-source-files.js:4:58)

I then added following in the tsconfig.json file:

{
  "compilerOptions": {
    // ...
    // paths are relative to `baseUrl` path.
    "paths": {
      "@angular/*": [
        "./node_modules/@angular/*"
      ]
    }
  }
}

but still getting the same error.

Following is my ng version info:

LTM027118:my-workspace ptiwari$ ng --version

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 7.3.10
Node: 10.15.1
OS: darwin x64
Angular: 7.2.16
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.13.10
@angular-devkit/build-angular      0.13.10
@angular-devkit/build-ng-packagr   0.13.10
@angular-devkit/build-optimizer    0.13.10
@angular-devkit/build-webpack      0.13.10
@angular-devkit/core               7.3.10
@angular-devkit/schematics         7.3.10
@angular/cli                       7.3.10
@ngtools/json-schema               1.1.0
@ngtools/webpack                   7.3.10
@schematics/angular                7.3.10
@schematics/update                 0.13.10
ng-packagr                         4.7.1
rxjs                               6.3.3
typescript                         3.2.4
webpack                            4.29.0
0

There are 0 answers