wiredfordesign wiredfordesign - 1 year ago 144
Node.js Question

RangeError: Invalid array buffer length - Meteor JS

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?

Answer Source

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

UPDATE

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