angular-cli: @ngtools/webpack - Error encountered resolving symbol values statically

Versions.

Repro steps.

Not really repro steps, but the not-changed webpack config used to work with angular@2.2.4 and @ngtools/webpack@1.1.9, since upgrading I get the error described below and I have no idea what to do about it.

The log given by the failure.

ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AnimationDriver in /Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/node_modules/@angular/platform-browser/src/dom/animation_driver.d.ts, resolving symbol BrowserTestingModule in /Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/node_modules/@angular/platform-browser/testing/browser.d.ts, resolving symbol BrowserTestingModule in /Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/node_modules/@angular/platform-browser/testing/browser.d.ts

ERROR in ./src/bootstrap.ts
Module not found: Error: Can't resolve './../$$_gendir/src/app/main.module.ngfactory' in '/Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/src'
 @ ./src/bootstrap.ts 3:0-83

ERROR in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
Module not found: Error: Can't resolve '/Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/$$_gendir' in '/Users/ajantsch/Dropbox/Projects/22_9Cookies/transmission-web-client/webkick/node_modules/@angular/core/src/linker'
 @ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 69:15-36 85:15-102
 @ ./~/@angular/core/src/linker.js
 @ ./~/@angular/core/src/core.js
 @ ./~/@angular/core/index.js
 @ ./src/bootstrap.ts

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 33
  • Comments: 77 (6 by maintainers)

Most upvoted comments

This Angular-cli is completely not ready for working with it…

Please, someone help us.

Why is this issue marked as close? the error message still appears after upgrading to beta 30 with AOT build.

I’m still getting this issue when running ng build --aot --prod Using angular-cli version beta25.5 (Recent upgrade, removed node_modules, ran ng init).

[...]
 95% emitting
Hash: bb7e79302cc7a41dc740
Time: 20780ms
chunk    {0} main.1c5fa69e760392c7ce83.bundle.js (main) 1.14 kB {2} [initial] [rendered]
chunk    {1} styles.9c92e557c163cbba0a69.bundle.css (styles) 2.37 kB {3} [initial] [rendered]
chunk    {2} vendor.aad8bb621ae4ff563de3.bundle.js (vendor) 1.06 MB [initial] [rendered]
chunk    {3} inline.1c680af8a30b36bb0fc2.bundle.js (inline) 0 bytes [entry] [rendered]

ERROR in Can't resolve all parameters for FirebaseSdkAuthBackend in /Users/asher/Sites/ds-front/node_modules/angularfire2/auth/firebase_sdk_auth_backend.d.ts: ([object Object], ?).

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/Users/asher/Sites/ds-front/src'
 @ ./src/main.ts 4:0-74
 @ multi main

ERROR in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
Module not found: Error: Can't resolve '/Users/asher/Sites/ds-front/src/$$_gendir' in '/Users/asher/Sites/ds-front/node_modules/@angular/core/src/linker'
 @ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 69:15-36 85:15-102
 @ ./~/@angular/core/src/linker.js
 @ ./~/@angular/core/src/core.js
 @ ./~/@angular/core/index.js
 @ ./src/main.ts
 @ multi main

Also on ng build -prod --aot

ERROR in this.host.isSourceFile is not a function

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/home/alex/Dev/ng2/tour-of-heroes-angularfire2/src'
 @ ./src/main.ts 4:0-74
 @ multi main

ERROR in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
Module not found: Error: Can't resolve '/home/alex/Dev/ng2/tour-of-heroes-angularfire2/src/$$_gendir' in '/home/alex/Dev/ng2/tour-of-heroes-angularfire2/node_modules/@angular/core/src/linker'
 @ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 69:15-36 85:15-102
 @ ./~/@angular/core/src/linker.js
 @ ./~/@angular/core/src/core.js
 @ ./~/@angular/core/index.js
 @ ./src/main.ts
 @ multi main

agreed…

I just ran into this problem, installing all the latest dependencies, and trying to run ng serve --prod --aot today. This should be reopened.

I managed to make it work after getting the same error: error in this.symbolResolver.getSymbolByModule is not a function webpack: Failed to compile.

I used this command to update all the packages npm update -D && npm update -S (source) did this 2-3 times and my app ran without any problems (ng serve).

@angular/cli: 1.0.0 node: 6.9.5 os: win32 x64 @angular/common: 4.0.2 @angular/compiler: 4.0.2 @angular/core: 4.0.2 @angular/forms: 4.0.2 @angular/http: 4.0.2 @angular/platform-browser: 4.0.2 @angular/platform-browser-dynamic: 4.0.2 @angular/router: 4.0.2 @angular/cli: 1.0.0 @angular/compiler-cli: 4.0.2

@Yamilquery we got the same error today. We had angular 4.0.1 libraries with angular/cli 1.0.0-rc.2 in our package.json.

angular/cli 1.0.0-rc.2 getting the latest version of angular/compiler-cli according its dependencies. (4.0.2 at this moment). And angular/compiler-cli 4.0.2 has angular/compiler 4.0.2 in peerDependencies, but it was not installed.

So, in our case update from angular 4.0.1 to 4.0.2 solved this error.

Keep getting this error with ng serve:

ERROR in this.symbolResolver.getSymbolByModule is not a function

with angular and angular/cli latest version. Since my project relies on primeng ultima template, I’m Trying to keep my project as close as possible to ultima demo project, which compiles correctly whereas mine doesn’t.

I’m getting a similar error: ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '[...]/src' @ ./src/main.ts 4:0-74 @ multi ./src/main.ts

my error is:

chunk    {0} main.bundle.js, 0.a8cf7fdcc46f9bd210ec.hot-update.js, main.bundle.map, main.bundle.map (main) 1.16 MB {3} [initial] [rendered]
chunk    {1} styles.bundle.css, styles.bundle.map, styles.bundle.map (styles) 324 kB {4} [initial]
chunk    {2} scripts.bundle.js, scripts.bundle.map (scripts) 232 kB {4} [initial]
chunk    {3} vendor.bundle.js, vendor.bundle.map (vendor) 6.34 MB [initial]
chunk    {4} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered]

ERROR in Error encountered resolving symbol values statically. Calling function 'ToastOptions', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in C:/msweb/studioDashboard/src/app/app.module.ts, resolving symbol AppModule in C:/msweb/studioDashboard/src/app/app.module.ts, resolving symbol AppModule in C:/msweb/studioDashboard/src/app/app.module.ts

latest everything…

project: https://github.com/born2net/studioDashboard

Something similar for me after upgrading

ERROR in Error encountered resolving symbol values statically. Only initialized variables and constants can be referenced because the value of this variable is needed by the template compiler (position 79:22 in the original .ts file), resolving symbol AUTH_PROVIDERS in C:/Xacte2/XacteUI-D/node_modules/angular2-jwt/angular2-jwt.d.ts, resolving symbol AppModule in C:/Xacte2/XacteUI-D/src/app/app.module.ts, resolving symbol AppModule in C:/Xacte2/XacteUI-D/src/app/app.module.ts

Help, I’m getting the same…

Nativescript It has been a headache!

 [820] ../~/nativescript-css-loader!./platform.ios.css 412 bytes [built]
 [821] ../~/nativescript-css-loader/lib/css-base.js 1.51 kB [built]
    + 807 hidden modules

WARNING in ./app.css
  resolve-url-loader cannot operate: CSS error
  /Users/yamildiazaguirre/Documents/node/LAaps/LevenLock/levenmas/app/app.css:6:37: property missing ':'
  at error (/Users/yamildiazaguirre/Documents/node/LAaps/LevenLock/levenmas/node_modules/css/lib/parse/index.js:62:15)

ERROR in this.symbolResolver.getSymbolByModule is not a function
Child app/app.component.html:
       [0] ./app.component.html 62 bytes {0} [built]
Child app/login/login.component.html:

    WARNING in ../~/resolve-url-loader!../~/nativescript-css-loader!../~/nativescript-dev-webpack/platform-css-loader.js!./app.css
      resolve-url-loader cannot operate: CSS error
      /Users/yamildiazaguirre/Documents/node/LAaps/LevenLock/levenmas/app/app.css:6:37: property missing ':'
      at error (/Users/yamildiazaguirre/Documents/node/LAaps/LevenLock/levenmas/node_modules/css/lib/parse/index.js:62:15)
child process exited with code 2

In the morning it worked perfect and suddenly stopped working …

I had this error when in appModule was

{ path: "work", loadChildren: "/modules/social/work/WorkModule#WorkModule" }

angular-cli beta-24 ng build and serve error at finish but dist directory creates:

Hash: 5e16130df6044b0b8bb7
Time: 26102ms chunk {0} main.f9a9d29d3531b5bb577d.bundle.js, main.f9a9d29d3531b5bb577d.bundle.map (main) 18.7 kB {2} [initial] [rendered] chunk {1} styles.4a4db805ac49f2977add.bundle.css, styles.4a4db805ac49f2977add.bundle.map, styles.4a4db805ac49f2977add.bundle.map (styles) 1.69 kB {3} [initial] [rendered] chunk {2} vendor.721d51ad17cc097115fc.bundle.js, vendor.721d51ad17cc097115fc.bundle.map (vendor) 3.28 MB [initial] [rendered] chunk {3} inline.3ee6c85492759d2c86ad.bundle.js, inline.3ee6c85492759d2c86ad.bundle.map (inline) 0 bytes [entry] [rendered]

ERROR in this.symbolResolver.getSymbolByModule is not a function

@SirBrecilos Running the command:

npm update -D && npm update -S

solved it for me. Thanks!

I’m still back on angular2, all I had to do was add the @angular/compiler-cli dependency to match the version of my @angular/compiler to fix this.

Same issue. Can this at least be dropped to a Warning so that my build process can continue? Everything appears to work fine despite this error.

Same issue here when importing an npm linked module. Using “angular-cli”: “1.0.0-beta.24”, @angular/*/2.4.4

With ng build --aot I also get a similar error:

ERROR in Error encountered resolving symbol values statically. Only initialized variables and constants can be referenced because the value of this variable is needed by the template compiler (position 7:12 in the original .ts file), resolving symbol Ng2BootstrapConfig in /foo/node_modules/ng2-bootstrap/components/ng2-bootstrap-config.d.ts, resolving symbol TypeaheadContainerComponent in /foo/node_modules/ng2-bootstrap/components/typeahead/typeahead-container.component.d.ts, resolving symbol TypeaheadContainerComponent in /foo/node_modules/ng2-bootstrap/components/typeahead/typeahead-container.component.d.ts

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './app/i18n/app/app.module.ngfactory' in '/foo/src'
 @ ./src/main.ts 4:0-73
 @ multi main

ERROR in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
Module not found: Error: Can't resolve '/foo/src/app/i18n' in '/foo/node_modules/@angular/core/src/linker'
 @ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 69:15-36 85:15-102
 @ ./~/@angular/core/src/linker.js
 @ ./~/@angular/core/src/core.js
 @ ./~/@angular/core/index.js
 @ ./src/main.ts
 @ multi main

As many, I was exposed after an ugrade to the message

ERROR in Error encountered resolving symbol values statically. Function calls are not supported. Consider replacing the function or lambda with a reference to an exported function,.....

My cause was in the reducers, who worked perfectly with 2.3 The solution was to replace export const myReducer: ActionReducer<string> = function(state: string = "pipo", action: Action){ by export function myReducer(state: string = "pipo", action: Action){ I hope it help getting from the hole I was stuck in for quite a few hours… Alex

@ajantsch that did the trick. I’m using the same helper method elsewhere in my webpack config but completely overlooked adding it to those paths in the plugin’s options.

thanks!

@bellizio unfortunately not, the only thing I do differently is that I use a helper function that creates the path-string.

var root = function (args) {
    args = Array.prototype.slice.call(arguments, 0);
    return path.join.apply(path, [__dirname].concat(args));
};
new AotPlugin({
    tsConfigPath: root('tsconfig.aot.json'),
    entryModule: root('src', 'app', 'main.module#MainModule'),
    mainPath: root('src', 'bootstrap.ts')
}),

any solution for this issue. I have same issue. here is how i am using AOTPlugin

{
 test: /\.ts$/, loaders: ['@ngtools/webpack']
}
new AOTPlugin({
         tsConfigPath: './tsconfig.json',
         entryModule: 'src/app/app.module#AppModule'
})

Same error here:

ERROR in this.host.isSourceFile is not a function

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/var/node/mauron85-background-geolocation-example-website/src'
 @ ./src/main.ts 5:29-76
 @ multi main

ERROR in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
Module not found: Error: Can't resolve '/var/node/mauron85-background-geolocation-example-website/src/$$_gendir' in '/var/node/mauron85-background-geolocation-example-website/node_modules/@angular/core/src/linker'
 @ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 69:15-36 85:15-102
 @ ./~/@angular/core/src/linker.js
 @ ./~/@angular/core/src/core.js
 @ ./~/@angular/core/index.js
 @ ./src/main.ts
 @ multi main
webpack: bundle is now VALID.

About my problem (Could not resolve “app/+home/home.module” from “/src/app/app.module.ts”). I changed the routing

FROM: export const routes: Routes = [ { path: ‘’, component: MainLayoutComponent, children: [ { path:‘’, children: [ { path: ‘home’, loadChildren: ‘app/+home/home.module#HomeModule’ }] } ] } ];

TO:

export const routes: Routes = [ { path: ‘’, component: MainLayoutComponent, children: [ { path:‘’, children: [ { path: ‘home’, loadChildren: ‘./+home/home.module#HomeModule’ }] } ] } ];