lathonez / clicker

Ionic 2 + @angular/cli Seed Project : Angular2 + Typescript + Karma + Protractor + Travis
http://lathonez.com/2018/ionic-2-unit-testing/
MIT License
430 stars 137 forks source link

Production build fails after upgrading to ionic 2.1.0 #236

Closed vbolshutkin closed 7 years ago

vbolshutkin commented 7 years ago

In clean working copy cloned from master branch with re-installed npm dependencies running ionic build browser --prod fails with the following error:

[19:01:01]  ngc started ... 
[19:01:02]  build prod failed: Error encountered resolving symbol values statically. Calling function 
            'NoOpAnimationDriver', function calls are not supported. Consider replacing the function or lambda with a 
            reference to an exported function, resolving symbol AnimationDriver.NOOP in 
            /home/user/devel/clicker/node_modules/@angular/platform-browser/src/dom/animation_driver.d.ts,
            resolving symbol BrowserTestingModule in 
            /home/user/devel/clicker/node_modules/@angular/platform-browser/testing/browser.d.ts, 
            resolving symbol BrowserTestingModule in 
            /home/user/devel/clicker/node_modules/@angular/platform-browser/testing/browser.d.ts 
[19:01:02]  ionic-app-script task: "build" 
[19:01:02]  Error: Error encountered resolving symbol values statically. Calling function 'NoOpAnimationDriver', 
            function calls are not supported. Consider replacing the function or lambda with a reference to an exported 
            function, resolving symbol AnimationDriver.NOOP in 
            /home/user/devel/clicker/node_modules/@angular/platform-browser/src/dom/animation_driver.d.ts,
            resolving symbol BrowserTestingModule in 
            /home/user/devel/clicker/node_modules/@angular/platform-browser/testing/browser.d.ts, 
            resolving symbol BrowserTestingModule in 
            /home/user/devel/clicker/node_modules/@angular/platform-browser/testing/browser.d.ts 
Error: Error encountered resolving symbol values statically. Calling function 'NoOpAnimationDriver', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AnimationDriver.NOOP in /home/user/devel/clicker/node_modules/@angular/platform-browser/src/dom/animation_driver.d.ts, resolving symbol BrowserTestingModule in /home/user/devel/clicker/node_modules/@angular/platform-browser/testing/browser.d.ts, resolving symbol BrowserTestingModule in /home/user/devel/clicker/node_modules/@angular/platform-browser/testing/browser.d.ts
    at simplifyInContext (/home/user/devel/clicker/node_modules/@angular/compiler/bundles/compiler.umd.js:25703:25)
    at StaticReflector.simplify (/home/user/devel/clicker/node_modules/@angular/compiler/bundles/compiler.umd.js:25715:15)
    at StaticReflector.annotations (/home/user/devel/clicker/node_modules/@angular/compiler/bundles/compiler.umd.js:25213:62)
    at NgModuleResolver.resolve (/home/user/devel/clicker/node_modules/@angular/compiler/bundles/compiler.umd.js:17573:84)
    at CompileMetadataResolver.getNgModuleMetadata (/home/user/devel/clicker/node_modules/@angular/compiler/bundles/compiler.umd.js:18081:62)
    at CompileMetadataResolver.getNgModuleSummary (/home/user/devel/clicker/node_modules/@angular/compiler/bundles/compiler.umd.js:18037:54)
    at /home/user/devel/clicker/node_modules/@angular/compiler/bundles/compiler.umd.js:18127:70
    at Array.forEach (native)
    at CompileMetadataResolver.getNgModuleMetadata (/home/user/devel/clicker/node_modules/@angular/compiler/bundles/compiler.umd.js:18122:51)
    at addNgModule (/home/user/devel/clicker/node_modules/@angular/compiler/bundles/compiler.umd.js:24975:60)

Before upgrading to ionic 2.1.0 (commit 13a6cd6ac94de0897b0e0d3dca65261f9c7ac3a8) it worked well.

lathonez commented 7 years ago

The only thing I can think of is the angular upgrade causing it?

Try downgrading to angular2.1 to see if it solves? Not a solution but I am AFK this weekend and it gets you somewhere.

On Sat, 11 Mar 2017 at 03:33, Vladimir Bolshutkin notifications@github.com wrote:

In clean working copy cloned from master branch with re-installed npm dependencies running ionic build browser --prod fails with the following error:

[19:01:01] ngc started ... [19:01:02] build prod failed: Error encountered resolving symbol values statically. Calling function 'NoOpAnimationDriver', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AnimationDriver.NOOP in /home/user/devel/clicker/node_modules/@angular/platform-browser/src/dom/animation_driver.d.ts, resolving symbol BrowserTestingModule in /home/user/devel/clicker/node_modules/@angular/platform-browser/testing/browser.d.ts, resolving symbol BrowserTestingModule in /home/user/devel/clicker/node_modules/@angular/platform-browser/testing/browser.d.ts [19:01:02] ionic-app-script task: "build" [19:01:02] Error: Error encountered resolving symbol values statically. Calling function 'NoOpAnimationDriver', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AnimationDriver.NOOP in /home/user/devel/clicker/node_modules/@angular/platform-browser/src/dom/animation_driver.d.ts, resolving symbol BrowserTestingModule in /home/user/devel/clicker/node_modules/@angular/platform-browser/testing/browser.d.ts, resolving symbol BrowserTestingModule in /home/user/devel/clicker/node_modules/@angular/platform-browser/testing/browser.d.ts Error: Error encountered resolving symbol values statically. Calling function 'NoOpAnimationDriver', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AnimationDriver.NOOP in /home/user/devel/clicker/node_modules/@angular/platform-browser/src/dom/animation_driver.d.ts, resolving symbol BrowserTestingModule in /home/user/devel/clicker/node_modules/@angular/platform-browser/testing/browser.d.ts, resolving symbol BrowserTestingModule in /home/user/devel/clicker/node_modules/@angular/platform-browser/testing/browser.d.ts at simplifyInContext (/home/user/devel/clicker/node_modules/@angular/compiler/bundles/compiler.umd.js:25703:25) at StaticReflector.simplify (/home/user/devel/clicker/node_modules/@angular/compiler/bundles/compiler.umd.js:25715:15) at StaticReflector.annotations (/home/user/devel/clicker/node_modules/@angular/compiler/bundles/compiler.umd.js:25213:62) at NgModuleResolver.resolve (/home/user/devel/clicker/node_modules/@angular/compiler/bundles/compiler.umd.js:17573:84) at CompileMetadataResolver.getNgModuleMetadata (/home/user/devel/clicker/node_modules/@angular/compiler/bundles/compiler.umd.js:18081:62) at CompileMetadataResolver.getNgModuleSummary (/home/user/devel/clicker/node_modules/@angular/compiler/bundles/compiler.umd.js:18037:54) at /home/user/devel/clicker/node_modules/@angular/compiler/bundles/compiler.umd.js:18127:70 at Array.forEach (native) at CompileMetadataResolver.getNgModuleMetadata (/home/user/devel/clicker/node_modules/@angular/compiler/bundles/compiler.umd.js:18122:51) at addNgModule (/home/user/devel/clicker/node_modules/@angular/compiler/bundles/compiler.umd.js:24975:60)

Before upgrading to ionic 2.1.0 (commit 13a6cd6 https://github.com/lathonez/clicker/commit/13a6cd6ac94de0897b0e0d3dca65261f9c7ac3a8) it worked well.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lathonez/clicker/issues/236, or mute the thread https://github.com/notifications/unsubscribe-auth/AG5tSBGY27YP9qnIsp-kHmk7RZ66xepUks5rkYJXgaJpZM4MZoDz .

lathonez commented 7 years ago

replicated

lathonez commented 7 years ago

confirmed that downgrading to angular 2.2.1 fixes (this specific problem) - not a solution

lathonez commented 7 years ago

fair few hits in angular/cli:

Suggestion seems to be excluding test.ts from build

lathonez commented 7 years ago

Straight upgrade of Ionic to angular2.4 on a starter project does not give the error, suggesting something from the testing framework must be the root cause (as suggested above)

saschwarz commented 7 years ago

I fixed this in my project by adding the following to: tsconfig.json:

"exclude": [
"src/test.ts",
"node_modules",
"**/*.spec.ts"
],

See also: https://github.com/driftyco/ionic-app-scripts/issues/806

lathonez commented 7 years ago

@saschwarz thanks - confirmed working here, needed both test.ts and *.spec.ts. There was a reason we didn't do this..

lathonez commented 7 years ago

Reason: https://github.com/lathonez/clicker/issues/174#issuecomment-261438411

Excluding spec makes the testing imports go missing in the editor. I do hate the fact that when I change code (and my tests break), ionic serve stops working though.

Maybe exlcuding spec from the main tsconfig.json is the lesser of two evils?

Also presumably there's a way of configuring one's editor outside of the project's tsconfig.json

lathonez commented 7 years ago

above should sort it, added some tests for the browser build into CI as a quick win.

TODO - update blog if this is legit

kamok commented 7 years ago

This issue came up again after upgrading to Ionic 3. The cause is a d.ts file related to @ionic/cloud-angular which I had installed previously to test out their service. After removing it, rolling back all the steps here: https://docs.ionic.io/setup.html, I was able to build again. I don't know why excluding node_modules in ts.config.json doesn't work. But that was where the file was.

lathonez commented 7 years ago

Not happening here or on travis:

https://s3.amazonaws.com/archive.travis-ci.org/jobs/220910203/log.txt

I've never used cloud-angular so I guess isolated to that.