angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

@ngtools/webpack - Error encountered resolving symbol values statically

Open ajantsch opened this issue 9 years ago • 77 comments

Versions.

Repro steps.

Not really repro steps, but the not-changed webpack config used to work with [email protected] and @ngtools/[email protected], 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

ajantsch avatar Dec 21 '16 10:12 ajantsch

My last mentioned error went away (and AoT compilation is now working again for me) after specifying 'mainPath' in my AoTPlugin.

ajantsch avatar Dec 22 '16 05:12 ajantsch

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' }] } ] } ];

gilbertogwa avatar Dec 22 '16 12:12 gilbertogwa

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

Likon84 avatar Dec 22 '16 18:12 Likon84

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

dessalines avatar Dec 27 '16 21:12 dessalines

agreed...

born2net avatar Dec 27 '16 21:12 born2net

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.

oliviercherrier avatar Dec 30 '16 10:12 oliviercherrier

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'
})

jorawarsingh avatar Jan 05 '17 04:01 jorawarsingh

@ajantsch I'm experiencing the same error you had: ERROR in Could not resolve "./src/app/app.module" from "./src/app/app.module".

I added the mainPath option as you mentioned, but the error remains.

Plugin config:

new ngToolsWebpack.AotPlugin({
      tsConfigPath: './tsconfig.aot.json',
      entryModule: './src/app/app.module#AppModule',
      mainPath: './src/app/main.ts'
    })

Versions:

Any ideas as to how to solve this issue?

bellizio avatar Jan 06 '17 21:01 bellizio

@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')
}),

ajantsch avatar Jan 09 '17 10:01 ajantsch

@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 avatar Jan 09 '17 13:01 bellizio

@hansl here's the repo with this bug, https://github.com/serhiisol/ng2-webpack. It generates error like this: screen shot 2017-01-12 at 10 22 31 pm

serhiisol avatar Jan 12 '17 21:01 serhiisol

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

AsherFoster avatar Jan 15 '17 03:01 AsherFoster

Getting this error with beta26 as well. Hope someone can help?

jfmaeck avatar Jan 22 '17 20:01 jfmaeck

same here after [email protected] update @angular/*/2.4.4

muradm avatar Jan 24 '17 06:01 muradm

Same here, with [email protected]/angular 2.4.4. Brand new app, getting this error while trying to use ng2-restangular 0.1.27

Calamitous avatar Jan 24 '17 19:01 Calamitous

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

mikelunn avatar Jan 24 '17 21:01 mikelunn

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.

1-0-1 avatar Jan 31 '17 20:01 1-0-1

Same here. Any updates?

seleccion_019

lvidal1 avatar Feb 02 '17 15:02 lvidal1

I am having this issue too. What is the fix?

HomeboxJim avatar Feb 03 '17 19:02 HomeboxJim

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

goldenbearkin avatar Feb 06 '17 13:02 goldenbearkin