I was just coding (Meteor JS) when this error started to crop up, and I'm not even sure what caused it:
buffer.js:25
const ui8 = new Uint8Array(size);
^
RangeError: Invalid array buffer length
at new ArrayBuffer (native)
at new Uint8Array (native)
at createBuffer (buffer.js:25:17)
at allocate (buffer.js:96:12)
at new Buffer (buffer.js:56:12)
at increaseBufferIfNecessary (C:\Users\admin\AppData\Local\.meteor\packages\meteor-tool\1.4.0-1\mtos.windows.x86_32\dev_bundle\lib\node_modules\stream-buffers\lib\writable_streambuffer.js:58:23)
at [object Object]._write (C:\Users\admin\AppData\Local\.meteor\packages\meteor-tool\1.4.0-1\mtos.windows.x86_32\dev_bundle\lib\node_modules\streambuffers\lib\writable_streambuffer.js:65:5)
at doWrite (_stream_writable.js:300:12)
at writeOrBuffer (_stream_writable.js:286:5)
at [object Object].Writable.write (_stream_writable.js:214:11)
at Request.ondata (stream.js:31:26)
at emitOne (events.js:82:20)
at Request.emit (events.js:169:7)
at IncomingMessage.<anonymous
(C:\Users\admin\AppData\Local\.meteor\packages\meteor-tool\1.4.0-1\mtos.windows.x86_32\dev_bundle\lib\node_modules\request\request.js:1255:12)
at emitOne (events.js:77:13)
at IncomingMessage.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:153:18)
at IncomingMessage.Readable.push (_stream_readable.js:111:10)
at HTTPParser.parserOnBody (_http_common.js:124:22)
at TLSSocket.socketOnData (_http_client.js:320:20)
at emitOne (events.js:77:13)
at TLSSocket.emit (events.js:169:7)
at readableAddChunk (_stream_readable.js:153:18)
at TLSSocket.Readable.push (_stream_readable.js:111:10)
at TLSWrap.onread (net.js:536:20)
I've tried to npm cache clear
but it hasn't helped. What could be causing this error? Is it my code or is it something else?
Cause of the error: The length of an Array or an ArrayBuffer can only be represented by an unsigned 32-bit integer, which only stores values ranging from 0 to 2 32 -1. While creating an Array or an ArrayBuffer, if the array length is either negative or greater than or equal to 2 32 then this error occurs.
The JavaScript exception "Invalid array length" occurs when creating an Array or an ArrayBuffer which has a length which is either negative or larger or equal to 2 32, or when setting the Array.length property to a value which is either negative or larger or equal to 2 32.
For ArrayBuffer the maximum is 2GB-1 on 32-bit systems (2^32-1). From Firefox version 89 the maximum value of ArrayBuffer is 8GB on 64-bit systems (2^33). Note: Array and ArrayBuffer are independent data structures (the implementation of one does not affect the other).
I'm in windows 10 and I also get this error after meteor started auto updating.
So here's what I did:
1) I remove dirs node_modules and .meteor/local:
rm -rf node_modules
rm -rf .meteor/local
2) meteor npm install
3) run meteor with: meteor
After trying the above and running meteor it worked but then after some time it started thworing same error. So I read somewhere to uninstall and install meteor again in Windows and that solved the error. Maybe try unistalling and installing it again if facing this bug
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With