nfroidure / ttf2woff2

Convert ttf files to woff2.
MIT License
297 stars 39 forks source link

RangeError: Array buffer allocation failed at Object. #38

Closed kathirr007 closed 2 years ago

kathirr007 commented 6 years ago

RangeError: Array buffer allocation failed at Object. (H:\Projects\Test\gulp-iconfont-generator\node_modules\ttf2woff2\jssrc\ttf2woff2.js:1:23296) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object. (H:\Projects\Test\gulp-iconfont-generator\node_modules\ttf2woff2\jssrc\index.js:3:27) at Module._compile (module.js:570:32)

I am getting this error only when i run this plugin with more number of svg files to convert into icon font.

Could anyone has the solution for this.

Thanks in advance.

gkorland commented 6 years ago

We're also getting it, any workaround?

@kathirr007 what do you mean by " with more number of svg files"?

nfroidure commented 6 years ago

You have that error because:

I do not know though if it is due to the fact it cannot fit in the NodeJS process allowed memory or if it simply reaches the maximum size a buffer can have.

Except switching to the native version, i have no clue of how to solve that problem. Also, may be worthy to check if you run the 32bit binary or the 64 one. The maximum buffer size may differ from one to another.

gkorland commented 6 years ago

What is considered "a lot of icons"?

On Tue, Nov 21, 2017, 12:00 Nicolas Froidure notifications@github.com wrote:

You have that error because:

  • you are using the JS fallback (not the native compiled version of ttf2woff2)
  • you have a lot of icons and it implies that the JS Emscripten fallback to create a big buffer.

I do not know though if it is due to the fact it cannot fit in the NodeJS process allowed memory or if it simply reaches the maximum size a buffer can have.

Except switching to the native version, i have no clue of how to solve that problem. Also, may be worthy to check if you run the 32bit binary or the 64 one. The maximum buffer size may differ from one to another.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/nfroidure/ttf2woff2/issues/38#issuecomment-345976386, or mute the thread https://github.com/notifications/unsubscribe-auth/AAt-NgoQSOtDhfTQXFTMrv1oyfFcyFPEks5s4p9JgaJpZM4QdML5 .

nfroidure commented 6 years ago

I do not know tbh. Didn't use this module since a while and even when I did, I was using the compiled version (GNU/Linux makes it a 0 config) tool.

Also since the max buffer size may vary, I guess that the "lot of icons" concept will vary accordingly.

YissacharB commented 6 years ago

Any idea?


(function (exports, require, module, __filename, __dirname) { var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=nodeFS["readFileSync"](filenam

RangeError: Array buffer allocation failed
    at new ArrayBuffer (<anonymous>)
    at Object.<anonymous> (D:\home\site\wwwroot\node_modules\ttf2woff2\jssrc\ttf2woff2.js:1:23296)
    at Module._compile (module.js:624:30)
    at Object.Module._extensions..js (module.js:635:10)
    at Module.load (module.js:545:32)
    at tryModuleLoad (module.js:508:12)
    at Function.Module._load (module.js:500:3)
    at Module.require (module.js:568:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (D:\home\site\wwwroot\node_modules\ttf2woff2\jssrc\index.js:3:27)
npm ERR! code ELIFECYCLE
npm ERR! errno 7
techhysahil commented 6 years ago

I also got same issue when i started deploying my application on DigitalOcean server. On local machine it was working fine. Can someone help my solving this.

screen shot 2017-11-22 at 9 38 48 pm
techhysahil commented 6 years ago

For quick fix, i solved above error by degrading to v1.1.0. I will get into actual bug when i will get sometime.

balajiHms commented 6 years ago

I have been facing same issue. I have created desktop application using electron.In that i have used pptxgen.js which is for making PPT generation using JavaScript. I got mentioned error and application has been crashed. "ERROR Error: Uncaught (in promise): RangeError: Array buffer allocation failed"

If anyone knows the solution kindly help me.

manishy635 commented 5 years ago

I have been facing same issue.

greatpants commented 5 years ago

I cant start my anyproxy for the same reason.Damn Nobody can help us.I guess its caused by insufficient memory .

nfroidure commented 5 years ago

I don't think the problem comes from insufficient memory (at least with a modern 8G of RAM computer without any Chrome, VSCode and Docker process running 😇).

Did you try to increase the NodeJS memory limit ? https://stackoverflow.com/questions/7193959/memory-limit-in-node-js-and-chrome-v8

iamgabrielsoft commented 2 years ago

Its due to large image, most times svgs image Not only images but other assets

mp-assco commented 2 years ago

I had the same problem. Nothing I did worked until I saw this random comment from a seemingly unrelated Git issue (https://github.com/angular/angular-cli/issues/21338#issuecomment-892473635) and, surprise surprise, I had 32-bit NodeJS installed. Uninstalling it and installing a 64-bit LTS solved it.

kathirr007 commented 2 years ago

Closing as this is the problem of Javascript fallback plugin.

jagtarsinghwork commented 2 years ago

There is simple solution for me, i am using window pc there i have vs code , my habit is always use vs code internal terminal , when i was npm start or yarn dev after 2-3 minnute gives me this error

SOLUTION WORKS FOR ME What i do i use the Terminal app or PowerShell now error is gone i dont know how before this i try many things like increase node buffer size and more now i am using external terminal