Comments (5)
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:
- Use full import paths for each icon, so that the bundler only loads what you use:
// 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";
- Increase the memory limit of the Node process. By default, I believe, Node only allocates 1024MB per process, and this error occurs when it tries to allocate something new and doesn't find enough memory remaining. You can give it more memory by changing the
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.
from react.
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.
![Screenshot 2024-06-12 at 12 52 06 PM](https://private-user-images.githubusercontent.com/70942776/338863382-63f05ede-1dd9-40b3-b8d1-c83d72aacc55.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk3NzM5NjEsIm5iZiI6MTcxOTc3MzY2MSwicGF0aCI6Ii83MDk0Mjc3Ni8zMzg4NjMzODItNjNmMDVlZGUtMWRkOS00MGIzLWI4ZDEtYzgzZDcyYWFjYzU1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MzAlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjMwVDE4NTQyMVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPThiN2VhZGJjNzljOTJmNTIzZmIxNjFmZThjNWNhODliYjZmNDNlYzQ0N2MxNzkyODVkMWQ2Y2RhYzAwNDU1YWQmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.tY87xaXhhCJxk9-1vNSaJYXJGD8eIs6_W_l1PSwNLBA)
from react.
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.
from react.
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.
from react.
Closing as out-of-scope. This is simply too old a runtime for us to support.
from react.
Related Issues (20)
- Add `@preview` tag to enable icon previews in jsdoc HOT 4
- Could not find a declaration file when using SSR HOT 2
- SSR Components missing default size="1em"
- SSR component types are not resolving
- allow to add Contributing.md file.
- Importing icons from `@phosphor-icons/react/dist/ssr` renders the icons, but gives issues in the editor HOT 5
- TypeError: Cannot create property 'displayName' on number 'Infinity' HOT 7
- Unble to dynamic import icons .mjs extensions HOT 9
- Icon instance className overwrites context className HOT 8
- New Twitter (x.com) icon? HOT 1
- Cannot find package on node 20 HOT 6
- ./node_modules/@phosphor-icons/react/dist/lib/context.mjs Can't import the named export 'createContext' from non EcmaScript module (only default export is available) HOT 10
- UnhandledRejection Error: Cannot Find React Package HOT 23
- 'use client' in client icons and IconContext HOT 2
- React warning after update to 2.1.4 HOT 1
- Issue updating past 2.1.3 HOT 2
- Incorrect exports specified in `package.json` HOT 1
- Jest test fails if importing directly from `/dist` folder
- Custom icons: Typescript and ESLint errors in Next.js 14 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react.