-
Notifications
You must be signed in to change notification settings - Fork 305
Build Scripts error - Getting Module build failed: RangeError: Maximum call stack size exceeded when using --prod with the build #996
Comments
Hello, thanks for using Ionic! So you have a custom build that pulls a new copy of your node_modules everytime you build? |
Hi, actually by custom build I just mean there is a script that cleans out a project folder, downloads the project from the repo, does the npm install, build resources etc. But in the end we just run stock ionic build, (eg ionic build android --release --prod) with no modifications. I still get this problem if I just build manually. Perhaps we can take that custom build out of the equation (only mentioned to make the point that I get a fresh node_modules each time.) I can give access to the private repo that this happens for if this will help diagnose? |
I'm having this same issue just doing
|
@dschnelzer Did you find any way around this issue yet dschnelzer? Of is there any other hints for this issue from anyone? I am no longer able to build my app, and I need to get an update out soon. Nothing I have tried fixes it apart from removing some of the libs that I know build in a newly created app. Is this some just limited stack size (that can perhaps be increased), or is it some sort of infinite recursion I wonder... |
I suddenly got the samme issue on my Mac when building for ios with the command : After some googling I found this https://forum.ionicframework.com/t/ionic-package-build-ios-profile-prod-fails-with-cert-issue/91544 and found that this command works:
Not sure why it works. Changes in the CLI maybe? |
@atlesp I can't try the above with the new CLI right now (and at work and I've only updated CLI at home), but are you sure the Perhaps the above is not doing this as it is not finding the You can open up the ipa file (rename to zip) and see if the final bundle looks minified etc (also you see the step ngc in the output while building) |
@pjc2007 you are right. |
I have the same problem. I tracked it down to a bug in TypeScript and filed a bug there: microsoft/TypeScript#16139 . Downgrading to TypeScript 2.3.0 fixed it. |
I still don't have |
@imgx64 thks |
Sadly, using TypeScript 2.3.0 did not fix this for me, nor did running The current error when using TypeScript 2.3.0 and the --minifyjs is
The log file has some different information (this is from the Windows machine building Android)...
|
@imgx64 thanks for the solution, downgrading to typescript 2.3.0 worked for me |
I tried again, updated to latest everything, except TypeScript 2.3.0 and I can now finally build production again, so @imgx64 thanks for that! |
For me problem was with jszip module... After remove it - build takes long, but success! TypeScript 2.3.0 |
I just downgraded Typescript to v2.3.0 and it's still not working. |
Similar issue reported here .
Your system information: ordova CLI: 6.3.1
Installed platforms: |
Can anyone please provide a minimal project that has this error? I did some initial tests but really need a sample project posted to github to inspect further. Please provide one 😄 |
@mhartington I have created one: https://github.com/tylervz/ionic_issue_996 |
Thanks @tylervz So I was abel to replicate the error, but it seems to be due to a missing dependency. From your base project, I just installed D3 and it was able to build without an issue.
This _kind of _ makes sense, since C3 is built on top of D3, though the error isn't really clear. Could you test that out? |
I'm having this problem too. I just updated my Ionic 2 app to Ionic 3 and the first time I ran If I delete the node_modules folder, run
local packages:
System:
I tried downgrading typescript to 2.3.0 but it didn't help. https://github.com/VadimDez/ng2-pdf-viewer If I remove this plugin the production build runs fine but when I add it back in the issue pops up again. An issue was filed there as well But @mhartington commented on it saying it wasn't an issue with the plugin so it must be with the cli? |
@mhartington before running
After running
|
The best bet is to just give Node more memory. I'm not sure there's anything else we can do right now. Thanks, |
@tylervz @mhartington @imgx64 I was able to stay on [email protected] and build with the --prod flag successfully after upgrading my d3 dependency from 3.5.16 to 4.9.1 (Ionic 3.5.0 + Ionic-App-Scripts 2.0.1). This required adding my webpack.config.js aliases to optimization.config.js so that my package.json build script looks like this:
Thanks for the d3 clues! Now to refactor a grip of chart UI code... |
There was also an Uglify-js error I had afterwards that was caused by case sensitivity of app.module.ts @import folder names. webpack/webpack#2972 |
@danbucholtz suggestion worked for me. I've added 3gb with --max-old-space-size=3072 and it completed the --prod build |
I've added the suggestion from @danbucholtz and the project does build now but it takes about 20 minutes to build a production build vs less than 30 seconds without the --prod flag. The pdf viewer also doesn't work in the production app even though it works fine with a debug build. |
@mhartington Upgrading d3 to 4.10.0 solved this problem for me after upgrading to ionic-app-scripts 2.1.3 and ionic-angular 3.6.0. |
@jjacobs33589 Did you get a solution for PDF Viewer? |
@danbucholtz There is something you could do. You could make it easier for us to increase node memory. In the past we could do this in package json but now it needs hacking on ~/AppData/npm/ionic.cmd on a Windows box, and probably something different elsewhere. One should be able to have a working buildable app checked into git without having to hack in the global space. E.g. the 'other' prod build failure cause is typescript 2.4.1+, and that can simply be resolved from package.json. |
I have just upgraded my Ionic, app-scripts etc, so I now have the following cli packages: (C:\Users\pchapman\AppData\Roaming\npm\node_modules)
global packages:
local packages:
System:
|
So, I ran into this bug with building a production release for my app, with a But, I finally got the production build process to complete by:
Only, after steps 2 and 3 above was the production build able to complete without errors. I hope this helps someone in a similar situation. |
I also found that the latest Typescript fixed it for me. |
Per @temiyemi's comment I also installed @types/d3@^3 and d3@^3 to upgraded to [email protected] and [email protected]. However, the Contentful (CMS API) dependency in my project would not compile with the --prod flag. I downgraded to [email protected] and all is well again. Thanks for the suggestions, guys! dependencies:
devDependencies
|
From @pjc2007 on May 16, 2017 13:5
Ionic version: (check one with "x")
[ ] 1.x
[ ] 2.x
[x] 3.x
I'm submitting a ... (check one with "x")
[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/
Current behavior:
I have a build where I get a clean copy of the npm modules each time I build. Out of the blue, I started getting the following error when building on a mac...
[16:22:01] RangeError: Maximum call stack size exceeded RangeError: Maximum call stack size exceeded at traverse (/Users/Development/dev/build/myapp/node_modules/typescript/lib/typescript.js:7252:26) at visitEachNode (/Users/Development/dev/build/myapp/node_modules/typescript/lib/typescript.js:14724:30) at Object.forEachChild (/Users/Development/dev/build/myapp/node_modules/typescript/lib/typescript.js:14896:24) at traverse (/Users/Development/dev/build/myapp/node_modules/typescript/lib/typescript.js:7271:31) at visitNode (/Users/Development/dev/build/myapp/node_modules/typescript/lib/typescript.js:14712:20) at Object.forEachChild (/Users/Development/dev/build/myapp/node_modules/typescript/lib/typescript.js:14910:21) at traverse (/Users/Development/dev/build/myapp/node_modules/typescript/lib/typescript.js:7271:31) at visitEachNode (/Users/Development/dev/build/myapp/node_modules/typescript/lib/typescript.js:14724:30) at Object.forEachChild (/Users/Development/dev/build/myapp/node_modules/typescript/lib/typescript.js:14896:24) at traverse (/Users/Development/dev/build/myapp/node_modules/typescript/lib/typescript.js:7271:31)
I went forward upgraded my Ionic 2 app to Ionic 3 (on my Windows machine), all of framework, Ionic native, and the CLI, which I wanted to anyway, however I am still getting a
Maximum call stack size exceeded
error, however this time it looks a bit different..`[16:50:08] webpack started ...
Error: ./
/jszip/lib/index.js/d3/d3.jsModule build failed: RangeError: Maximum call stack size exceeded
at Object.forEachChild (D:\dev\myapp\node_modules\typescript\lib\typescript.js:14735:26)
at traverse (D:\dev\myapp\node_modules\typescript\lib\typescript.js:7271:31)
at Object.forEachReturnStatement (D:\dev\myapp\node_modules\typescript\lib\typescript.js:7251:16)
at checkAndAggregateReturnExpressionTypes (D:\dev\myapp\node_modules\typescript\lib\typescript.js:40055:16)
at getReturnTypeFromBody (D:\dev\myapp\node_modules\typescript\lib\typescript.js:39965:29)
at getReturnTypeOfSignature (D:\dev\myapp\node_modules\typescript\lib\typescript.js:31190:28)
at resolveNewExpression (D:\dev\myapp\node_modules\typescript\lib\typescript.js:39483:21)
at resolveSignature (D:\dev\myapp\node_modules\typescript\lib\typescript.js:39639:28)
at getResolvedSignature (D:\dev\myapp\node_modules\typescript\lib\typescript.js:39669:26)
at checkCallExpression (D:\dev\myapp\node_modules\typescript\lib\typescript.js:39696:29)
@ ./src/providers/file-logger.ts 58:0-28
@ ./src/app/app.module.ngfactory.ts
@ ./src/app/main.ts,./
Module build failed: RangeError: Maximum call stack size exceeded
at RegExp.[Symbol.replace] (native)
at String.replace (native)
at formatStringFromArgs (D:\dev\myapp\node_modules\typescript\lib\typescript.js:2365:21)
at Object.chainDiagnosticMessages (D:\dev\myapp\node_modules\typescript\lib\typescript.js:2433:20)
at reportNonexistentProperty (D:\dev\myapp\node_modules\typescript\lib\typescript.js:38290:28)
at checkPropertyAccessExpressionOrQualifiedName (D:\dev\myapp\node_modules\typescript\lib\typescript.js:38332:
21)
at checkPropertyAccessExpression (D:\dev\myapp\node_modules\typescript\lib\typescript.js:38274:20)
at checkExpressionWorker (D:\dev\myapp\node_modules\typescript\lib\typescript.js:41158:28)
at checkExpression (D:\dev\myapp\node_modules\typescript\lib\typescript.js:41115:42)
at checkExpressionWithContextualType (D:\dev\myapp\node_modules\typescript\lib\typescript.js:40983:26)
@ ./src/pages/mypage/mypage.ts 61:0-25
@ ./src/app/app.module.ts
@ ./src/app/app.module.ngfactory.ts
@ ./src/app/main.ts
`
If I remove the C3 (graph library) and jszip (as indicated are problems in the above), then the errors goes away. If I use C3 and/or jszip in a newly created blank application, I do not get the errors (hence at this stage I can't provide a small example.
I have done many many builds, and have not seen this before. A forum suggestion was to report it as an app scripts issue, as I am doing here.
It is only when building with the --prod flag
Expected behavior:
To be able to build the application using the --prod flag. Is there some why to to alter the build scripts?
Is this some problem with the scripts config that can cause this?
Steps to reproduce:
This is hard, at this stage, it seems to only happen in my ongoing application, and not a new blank app. Perhaps it is the size (though it is not that big, around 6 pages, and a number of providers, maybe 10 or so - final build package of around 3.5M)
Other information:
I have asked this in the forum here, and again on Stack Overflow
Ionic info: (run
ionic info
from a terminal/cmd prompt and paste output below):Copied from original issue: ionic-team/ionic-framework#11691
The text was updated successfully, but these errors were encountered: