国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

node.js - webpack package reports javaScript heap out of memory, how to solve it?
滿天的星座
滿天的星座 2017-05-16 13:38:41
0
2
1338
將nodejs從5.1.1升級(jí)到6.10.2之后,執(zhí)行生產(chǎn)環(huán)境的打包(`set NODE_ENV=production  && webpack  --config webpack.production.config.js`),控制臺(tái)報(bào)錯(cuò):“CALL_AND_RETYR_LAST Allocation failed -javascript heap out of memoty”。
![圖片描述](/img/bVMNK1)(這是一張圖片,為什么上傳不了?)
我nodejs版本是6.10.2, npm原本是3.10.X,后臺(tái)看在stackoverflow上看到有人說把npm更新到最新版就能解決這個(gè)問題,npm最后更新到4.5.0。

無論是百度還是stackoverflow,我都找過解決方案(我找到了webpack.cmd,在命令行“node  "%~dp0\node_modules\webpack\bin\webpack.js" %* ”添加 "-max_old_space_size = 2048"參數(shù)),并且嘗試了,但是沒有用,怎么破?
滿天的星座
滿天的星座

reply all(2)
為情所困

Hey, I finally did it myself. In fact, now I find that the idea I started to solve the problem is correct, which is to add "--max_old_space_size" to the node command line. The mistake is that I added it in the wrong place (maybe it doesn't work in my environment?). At first, I referred to the solution provided by segmentfault on a problem where the same weback packaging caused nodejs memory overflow, which was to add it to the global webpack.cmd (the path is: C:UsersAdministratorAppDataRoamingnpmwebpack.cmd), as shown below :

But it was found that it did not work. After executing the command, the memory still overflowed. Then I struggled for a long time, and the next day I searched for the answer again on stackoverflow and found this answer:

So, I changed the npm hook script used for packaging in my production environment to: "set NODE_ENV =production && node --max_old_space_size=2048 node_modules/webpack/bin/webpack.js --config webpack.production.config.js". That is to say, I use local/local webpack instead of globally installed webpack for packaging. The memory overflow problem was solved by adding "--max_old_space_size=2048" to nodejs to expand the memory to 2*1024M=2G.

Peter_Zhu

There is too little evidence to solve the case!

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template