Reputation: 61
When I try to run the application using HTTPS=true npm start
command got the below error:
RangeError: Invalid typed array length: -4095 when running my react web app
However I was able to run the application using npm start
Error - `
internal/buffer.js:788
class FastBuffer extends Uint8Array {}
^
RangeError: Invalid typed array length: -4095
at new Uint8Array (<anonymous>)
at new FastBuffer (internal/buffer.js:788:1)
at Handle.onStreamRead [as onread] (internal/stream_base_commons.js:153:17)
at Stream.<anonymous> (/Users/kithma/Documents/wellbee/wb-web/node_modules/handle-thing/lib/handle.js:120:12)
at Stream.emit (events.js:198:15)
at endReadableNT (/Users/kithma/Documents/wellbee/wb-web/node_modules/readable-stream/lib/_stream_readable.js:1010:12)
at processTicksAndRejections (internal/process/task_queues.js:81:17)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `react-app-rewired start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.`
Upvotes: 5
Views: 4053
Reputation: 3762
If you are using Next.js
with webpack v. 5.x
you may try to downgrade webpack to v. 4.x
(in my case it helped).
Just add to next.config.js
module.exports = {
// next.config.js
webpack5: false,
}
Upvotes: 0
Reputation: 624
Despite the fact that the fix below was made not for React, I think it could do a trick for React too as it seems the problem again in the old version of the package handle-thing
which is probably used by some dependency.
As the first step please check that guess with a command npm list handle-thing
and if it outputs not the latest version of handle-thing
you can try a solution below.
My situation:
npm list handle-thing gives me [email protected]
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:
install https://www.npmjs.com/package/npm-force-resolutions
do not forget scripts / preinstall step
add/modify that section into package.json:
"resolutions": { "handle-thing": "^2.0.1" }
make npm install
start your web app in SSL mode
Tested with node v14.13.1
The solution is taken from the discussion https://github.com/nodejs/node/issues/24097
Upvotes: 3
Reputation: 611
Upgrading your react & react-scripts dependencies should resolve this issue.
For me after bumping "react": "^16.13.1"
and "react-scripts": "^3.4.1"
the problem went away. I'm also using node v12 FYI.
Upvotes: 1