Closed nitish-javis closed 4 months ago
This is a pretty classic out-of-memory error that unfortunately happens because your build process is probably trying to load thousands of icons into memory while bundling, which is usually not necessary.
You can fix this a few ways:
// this
import { Check } from "@phosphor-icons/react/dist/csr/Check";
import { Smiley } from "@phosphor-icons/react/dist/csr/Smiley";
// instead of this
import { Check, Smiley } from "@phosphor-icons/react";
max-old-space-size
option by setting an environment variable before calling your command:
export NODE_OPTIONS="--max-old-space-size=4096"
npm run build
You can also just add it to the script in package.json
:
{
"scripts": {
"build": "NODE_OPTIONS='--max-old-space-size=4096' vite build"
}
}
Obviously the rest of your build command will differ based on the tools you're using, but it should work with everything. You can play around with the number, but 4GB should be plenty.
Hi @rektdeckard ,
We changed the imports according to your suggestion and we also tried running the server by increasing the node memory allocated. It still doesn't work. However, this time it throws some other error.
That error is entirely different, and looks to be webpack exceeding the maximum string length in Node, which depending on your version of Node could be as low as ~260MB. I am not here to debug your application, but it sounds like you have some problems in your build setup.
Try upgrading Node (and webpack) if you're on an old version, look for anything that is concatenating into a massive string, and maybe try doing some debugging yourself.
BTW it looks like you are using Node 15, which reached End Of Life like 2 years ago. Upgrading may resolve the problem, as memory allocation has undoubtedly improved in 9 major versions of Node.
Closing as out-of-scope. This is simply too old a runtime for us to support.
I'm facing this bug while doing
npm run build
. Tried to debug but couldn't find anything useful. But when I removed the phosphor icon library, then build worked fine.OS: Mac Browser: Chrome
If anyone could help me here, it would be a great help. Thanks