Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RangeError: Invalid typed array length #24097

Closed
kmiasko opened this issue Nov 5, 2018 · 21 comments
Closed

RangeError: Invalid typed array length #24097

kmiasko opened this issue Nov 5, 2018 · 21 comments
Labels
help wanted Issues that need assistance from volunteers or PRs that need help to proceed. invalid Issues and PRs that are invalid. wrong repo Issues that should be opened in another repository.

Comments

@kmiasko
Copy link

kmiasko commented Nov 5, 2018

After upgrading to node 11.1 webpack-dev-server (i assume) can't serve angular 5 app build with this error:

webpack: Compiled successfully.
buffer.js:72
class FastBuffer extends Uint8Array {}
^

RangeError: Invalid typed array length: -4095
at new Uint8Array (<anonymous>)
at new FastBuffer (buffer.js:72:1)
at Handle.onStreamRead [as onread] (internal/stream_base_commons.js:121:17) at Stream.<anonymous>
(node_modules/handle-thing/lib/handle.js:120:12)
at Stream.emit (events.js:187:15) at endReadableNT
(node_modules/readable-stream/lib/_stream_readable.js:992:12)
at process.internalTickCallback (internal/process/next_tick.js:72:19)

@sebastianplsim
Copy link

I'm also seeing the same thing trying to start a react app with yarn.

  • yarn: 1.12.1
  • node: v11.1.0
  • Platform: Mac OS 10.14

@damejia100
Copy link

I ran into the same error. It's not a total fix but downgrading my node version got me back up and running. Here's what I did:
sudo npm cache clean -f
sudo npm install -g n
sudo n <version> <- I downgraded to 10.6.0

@Trott
Copy link
Member

Trott commented Nov 6, 2018

Pretty sure that message is coming from V8. Not sure if it's a bug in V8, or the result of a bug fix in V8, or neither... @nodejs/v8

@bmeurer
Copy link
Member

bmeurer commented Nov 6, 2018

cc @psmarshall

@ciaranschutte
Copy link

fixed by removing all node folders, reinstalling nvm, reinstalling node

@psmarshall
Copy link
Contributor

Throwing when a typed array is constructed with a negative length argument is the correct behaviour according to the spec. I don't think we changed anything here recently, so the bug is most likely in node or one of the modules used

@mergederg
Copy link

mergederg commented Nov 14, 2018

Also seeing this starting in the last couple of days. Webpack will compile it okay, but once you make a request it collapses in on itself.

Can get around the crash by going back to older node (10.6.0 worked okay), but that kinda has problems of its own.

Project is running at <redacted>
webpack output is served from /
404s will fallback to /index.html
webpack: wait until bundle finished: /
buffer.js:72
class FastBuffer extends Uint8Array {}
^

RangeError: Invalid typed array length: -4095
    at new Uint8Array (<anonymous>)
    at new FastBuffer (buffer.js:72:1)
    at Handle.onStreamRead [as onread] (internal/stream_base_commons.js:121:17)
    at Stream.<anonymous> (<redacted>/node_modules/handle-thing/lib/handle.js:120:12)
    at Stream.emit (events.js:187:15)
    at endReadableNT (<redacted>/node_modules/readable-stream/lib/_stream_readable.js:1010:12)
    at process.internalTickCallback (internal/process/next_tick.js:72:19)

@psmarshall psmarshall added the help wanted Issues that need assistance from volunteers or PRs that need help to proceed. label Nov 14, 2018
@bnoordhuis
Copy link
Member

Going by the stack trace, it's almost certainly a bug in the handle-thing module. I'm going to close this out as not-our-bug. Please report it to that module's maintainers.

cc @indutny since you're one of its maintainers. If it helps, -4095 is libuv's EOF status code.

@bnoordhuis bnoordhuis added invalid Issues and PRs that are invalid. wrong repo Issues that should be opened in another repository. labels Nov 15, 2018
@Gribbs
Copy link

Gribbs commented Nov 28, 2018

upgrading react-scripts did the trick for my create-react-app without having to downgrade from node 11:

yarn add react-scripts
rm -rf node_modules/
yarn

all better!

@AmericaGL
Copy link

AmericaGL commented Dec 12, 2018

why not try this one instead after you uninstall the node
brew install node --HEAD

@slayb3ar
Copy link

@kmiasko did you ever find a workaround? started getting this exact issue a few days back and just can't figure out what the fix is.

@webmcheck
Copy link

webmcheck commented Dec 13, 2018

Same problem. Webpack can't start or dying after the first request. Before that, I update node to 11.4. Maybe it's not a node bug but I have no idea how to detect problem package. node < 10.6 works well

@slayb3ar
Copy link

Yeah exact same thing here @webmcheck . Strangest thing is that this issue just popped out of nowhere. Didn't upgrade NPM or yarn or anything like that.

@kmiasko
Copy link
Author

kmiasko commented Dec 14, 2018

@webmcheck @camus-code spdy-http2/handle-thing#5 (comment)

That's the package that is causing problems. It's already fixed, but packages that use older version of this package won't work on node >= 11.1 (ie. angular 5.x fails, angular 7.x works ok).

@slayb3ar
Copy link

Ahhh okay. Thanks for the response @kmiasko . Ended up downgrading my node version and things are back to normal.

@eyz
Copy link

eyz commented Dec 28, 2018

I'm pretty sure spdy-http2/handle-thing#6 is the tracking issue for the NodeJS 11.x handle-thing fixes, not handle-thing#5, which was for NodeJS 10.x, but perhaps @jacobheun can confirm for certain the intent.

@jacobheun
Copy link

@eyz that's correct. I recently got supported added for node LTS versions, but ran out of time to get updates in for node 11. Internal stream behavior changed in node 11 which caused the issue in handle-thing. handle-thing needs to be updated to account for those.

@FullStackAlex
Copy link

Thanx to @damejia100, but instead of downgrading I've upgraded node to the latest stable version (10.15.3):

sudo npm cache clean -f
sudo npm install -g n
sudo n stable

and the error has gone

@zmeeagain
Copy link

10.17.0 also works.

@KEMBL
Copy link

KEMBL commented Dec 11, 2020

As @eyz has mentioned problem indeed with the old spdy-http2/handle-thing (at least in my case)

npm list handle-thing gives me handle-thing@1.2.5 which is a dependency of old angular/cli which I cannot update for now.

Also, I cannot use yarn to override package resolutions, fix below has worked for me:

  1. install https://www.npmjs.com/package/npm-force-resolutions
    do not forget scripts / preinstall step

  2. add that section into package.json:
    "resolutions": {
    "handle-thing": "^2.0.1"
    }

  3. make npm install

  4. start your web app in SSL mode

tested with node v14.13.1

espadrine added a commit to espadrine/sc that referenced this issue Mar 23, 2021
The following issue occurs with the current version of spdy:
nodejs/node#24097
@vishal1785
Copy link

vishal1785 commented Mar 23, 2022

This solved my issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Issues that need assistance from volunteers or PRs that need help to proceed. invalid Issues and PRs that are invalid. wrong repo Issues that should be opened in another repository.
Projects
None yet
Development

No branches or pull requests