Open honk7608 opened 2 years ago
Anyone who can resolve this issue?
According to the stacktrace of the error, it seems like you're trying to initialize an array with way too many elements, this is caused by the V8 engine as there's a maximum array size specified.
The maximum amount of elements can vary depending on the target machine, but the common maximum size is the 32-bit unsigned integer, AKA 4,294,967,296 (4,29 billion) elements, if you try to create an array larger than this, that can be caused, although as said, this is depenedent on the target machine and the maximum heap it could provide as well.
How can I find out which line of code causes the array that is too big?
Too bad there isn't a stacktrace of the Javascript code that causes it. After all, there is a specific line of code that adds the element that makes the array too big.
In my case, it seems to be a non-terminating loop that adds elements to an array. Of course there are methods to find the cause, but a stacktrace would be quite helpful.
I moved "react-scripts": "5.0.1" from dependencies to devDependencies in package.json , this saved me.
I moved "react-scripts": "5.0.1" from dependencies to devDependencies in package.json , this saved me.
It works for me. What is the impact of this config change?
how did you fix that error in your code? cause am having the same error
What framework are you using, For me, I lowered the next.js version and it worked.
I was having this issue with Nestjs v 9.20 when I tried to install stripe
. I moved all of my @types/* dependecies to dev dependencies and now everything works.
I'm having this issue with NextJS 12.3 when dev
is set to true
like const nextServer = next({ dev: true });
Edit: I resolved it by deleting the .next
folder.
What I want to know is why this error instantly crashes Node with no backtrace and no meaningful explanation - surely this could just be handled by throwing an exception, which would allow the error to be caught by test runners and presented nicely in CI rather than causing everything to break.
I moved "react-scripts": "5.0.1" from dependencies to devDependencies in package.json , this saved me.
i encountered this error using JSFuck 0.5.0
I was having this issue with Nestjs v 9.20 when I tried to install
stripe
. I moved all of my @types/* dependecies to dev dependencies and now everything works.
Thank's its work for me 👍❤️
In my case, it was a cyclical dependency within a monorepo project. Turbo was able to recognise this when I tried to run a custom cleanup job, which removes all .turbo
, .next
, node_modules
, and re-installs everything. It failed with the exact cyclical path.
In my case, it was a cyclical dependency within a monorepo project. Turbo was able to recognise this when I tried to run a custom cleanup job, which removes all
.turbo
,.next
,node_modules
, and re-installs everything. It failed with the exact cyclical path.
@yanickrochon could you share the contents of your cleanup job? I am facing the same issue in a monorepo project.
@tom-carbontrail sure!
The turborepo's root package.json
has this (partial file content):
{
"private": true,
"packageManager": "pnpm@8.10.2",
"scripts": {
"reset": "turbo reset && rimraf pnpm-lock.yaml node_modules && pnpm i"
},
"devDependencies": {
"rimraf": "^5.0.5"
}
}
The turbo.json
file (partial)
{
"$schema": "https://turborepo.org/schema.json",
"pipeline": {
"reset": {
"cache": false
}
}
}
Each of my package.json
look like this (partial, update according to your own build requirements) :
{
"name": "@vit3x/accounts",
"scripts": {
"reset": "rimraf .next .turbo node_modules"
}
}
Thens imply run pnpm reset
. This will flush all artefacts and node_modules
, then reinstall everything.
Ah I see. My files look similar, I wondered if you were running a script or similar to detect cyclic dependencies.
I added 'import/no-cycle': ["warn"],
to my Eslint config to help me find them in my project, and found the culprits. My tests (with jest
) now run again.
Thanks for your help.
@tom-carbontrail pnpm
warns about cyclical dependencies when you run pnpm i
and it has to rebuild the cache. If your solution works, that's great too!
I moved "react-scripts": "5.0.1" from dependencies to devDependencies in package.json , this saved me too.
Hi! If this issue is resolved, could a member (or the author) close it? If it's not resolved, ignore this message.
If you don't have access, and you think this issue is resolved, :+1: this message, and I'll close the issue myself.
Thanks!
Details
Why this error happend and how can I fix?
Node.js version
v16.13.2
Example code
No response
Operating system
Window 11
Scope
runtime
Module and version
Not applicable.