Memory limit error when running project

No description
51 Replies
shyamsundertard
shyamsundertardOP2mo ago
No description
martmull
martmull2mo ago
hey @shyamsundertard, what command did you run?
shyamsundertard
shyamsundertardOP2mo ago
npx nx start
martmull
martmull2mo ago
can you past the full error please?
shyamsundertard
shyamsundertardOP2mo ago
Ok
martmull
martmull2mo ago
thanks I need to check which subcommand is failing
shyamsundertard
shyamsundertardOP2mo ago
node:events:495 throw er; // Unhandled 'error' event ^ Error: Worker terminated due to reaching memory limit: JS heap out of memory at new NodeError (node:internal/errors:405:5) at [kOnExit] (node:internal/worker:301:26) at Worker.<computed>.onexit (node:internal/worker:222:20) Emitted 'error' event on Worker instance at: at [kOnExit] (node:internal/worker:301:12) at Worker.<computed>.onexit (node:internal/worker:222:20) { code: 'ERR_WORKER_OUT_OF_MEMORY' }
martmull
martmull2mo ago
there is nothing above that ?
shyamsundertard
shyamsundertardOP2mo ago
Above code have no error, that code comes after running "npx nx start", and giving no errors
martmull
martmull2mo ago
please paste all
shyamsundertard
shyamsundertardOP2mo ago
But when the web starts to load it gives that error, then on web I get "This site can't be reached" Ok
martmull
martmull2mo ago
Thanks, may not be useful but i would like to be sure
martmull
martmull2mo ago
thanks, looking at it
shyamsundertard
shyamsundertardOP2mo ago
ok,thanks
martmull
martmull2mo ago
what ram memory does your macbookair have?
shyamsundertard
shyamsundertardOP2mo ago
8GB
martmull
martmull2mo ago
can you try to run only those 2 commands instead of npx nx start?
npx nx start twenty-server
npx nx start twenty-front
npx nx start twenty-server
npx nx start twenty-front
in 2 separated terminals @charles do you have an idea?
shyamsundertard
shyamsundertardOP2mo ago
ok oxygen@MacBookAir twenty % npx nx start twenty-front NX Running target start for project twenty-front and 2 tasks it depends on: —————————————————————————————————————
nx run twenty-ui:generateBarrels [existing outputs match the cache, left as is]
nx run twenty-ui:build [existing outputs match the cache, left as is]
nx run twenty-front:start
➜ Local: http://localhost:3001/ node:events:495 throw er; // Unhandled 'error' event ^ Error: Worker terminated due to reaching memory limit: JS heap out of memory at new NodeError (node:internal/errors:405:5) at [kOnExit] (node:internal/worker:301:26) at Worker.<computed>.onexit (node:internal/worker:222:20) Emitted 'error' event on Worker instance at: at [kOnExit] (node:internal/worker:301:12) at Worker.<computed>.onexit (node:internal/worker:222:20) { code: 'ERR_WORKER_OUT_OF_MEMORY' } Node.js v18.20.4 ————————————————————————————————————— NX Running target start for project twenty-front and 2 tasks it depends on failed Failed tasks: - twenty-front:start Hint: run the command with --verbose for more details. npx nx start twenty-server is running
martmull
martmull2mo ago
ok, so the twenty-front:start command is the issue
shyamsundertard
shyamsundertardOP2mo ago
yes
charles
charles2mo ago
@shyamsundertard how much RAM do you have on your machine? (docker vm or vm if you are using them) The project requires ~5GB to run to get the full dev experience. This is mainly due to two background checks: linter + typescript checker (tsc). If you can, I would recommend to increase your machine RAM (in case of VM) If you can't you can disable these background checks: See: packages/twenty-front/.env.example. Add in your .env VITE_DISABLE_TYPESCRIPT_CHECKER=true and VITE_DISABLE_ESLINT_CHECKER=true this will make running your front way lighter
shyamsundertard
shyamsundertardOP2mo ago
I am not using docker or any any vm, just using postgres in my device itself, it has 8/256 RAM/ROM
charles
charles2mo ago
ok ! so add the env variables to your .env and you should be fine! your IDE will also check the typescript and lint if properly configured (by default with VSCODE) so you should be fine
shyamsundertard
shyamsundertardOP2mo ago
which env variables? As per project setup I pasted from .env.example to their respective .env
charles
charles2mo ago
VITE_DISABLE_TYPESCRIPT_CHECKER=true and VITE_DISABLE_ESLINT_CHECKER=true in packages/twenty-front/.env
shyamsundertard
shyamsundertardOP2mo ago
Thanks, now working without error. Thanks @charles and @martmull
martmull
martmull2mo ago
With pleasure, happy it works 🤗
oyiks
oyiks2mo ago
I ran the 'npx nx start twenty-front' and 'npx start twenty-server' command to start the project. Here is the error I am getting.
shyamsundertard
shyamsundertardOP2mo ago
Have to made above discussed changes ?
oyiks
oyiks2mo ago
I need help to make it work.
charles
charles2mo ago
yes, it will help a lot!
oyiks
oyiks2mo ago
Yes I have. I did this VITE_DISABLE_TYPESCRIPT_CHECKER=true and VITE_DISABLE_ESLINT_CHECKER=true in packages/twenty-front/.env Still having issues.
shyamsundertard
shyamsundertardOP2mo ago
@oyiks Also go to packages/twnety-front/package.json and in that change 3000 with 4096 as it will increase memory size
oyiks
oyiks2mo ago
Alright then.
charles
charles2mo ago
how much RAM do you have?
oyiks
oyiks2mo ago
6gb RAM.
charles
charles2mo ago
could you run your front, check how much it takes, then run your server and check how much it takes too? (using top command if you are on linux or Activity Monitor if you are on mac)
oyiks
oyiks2mo ago
Alright then. I am using WSL on windows.
charles
charles2mo ago
Okay and 6gb is the ram of your linux VM right? not your Windows host
oyiks
oyiks2mo ago
6gb is RAM of my windows host not the linux VM. This is what I find. { "name": "twenty-front", "version": "0.31.0", "private": true, "type": "module", "scripts": { "build": "VITE_DISABLE_TYPESCRIPT_CHECKER=true VITE_DISABLE_ESLINT_CHECKER=true NODE_OPTIONS=--max-old-space-size=3000 npx vite build && sh ./scripts/inject-runtime-env.sh", "build:sourcemaps": "VITE_BUILD_SOURCEMAP=true VITE_DISABLE_TYPESCRIPT_CHECKER=true VITE_DISABLE_ESLINT_CHECKER=true NODE_OPTIONS=--max-old-space-size=6000 npx vite build && sh ./scripts/inject-runtime-env.sh", "start:prod": "NODE_ENV=production npx vite --host", "tsup": "npx tsup" }, "engines": { "node": "^18.17.1", "npm": "please-use-yarn", "yarn": "^4.0.2" }, "browserslist": { "production": [ ">0.2%", "not dead", "not op_mini all" ], "development": [ "last 1 chrome version", "last 1 firefox version", "last 1 safari version" ] }, "msw": { "workerDirectory": "public" }, "dependencies": { "@xyflow/react": "^12.0.4", "transliteration": "^2.3.5" } }
shyamsundertard
shyamsundertardOP2mo ago
In build replace 3000 by 4096
oyiks
oyiks2mo ago
Done. I can run npx nx start now right?
charles
charles2mo ago
How much do you have on your LInux vm?
oyiks
oyiks2mo ago
I don't know, how do I check that? I still have the same error. npx nx start twenty-front NX Running target start for project twenty-front and 2 tasks it depends on: ———————————————————————————————————————————————————————————————————————————————————————————————————————————————————————
nx run twenty-ui:generateBarrels [local cache]
nx run twenty-ui:build [local cache]
nx run twenty-front:start
➜ Local: http://localhost:3001/ node:events:492 throw er; // Unhandled 'error' event ^ Error [ERR_WORKER_OUT_OF_MEMORY]: Worker terminated due to reaching memory limit: JS heap out of memory at new NodeError (node:internal/errors:405:5) at [kOnExit] (node:internal/worker:287:26) at Worker.<computed>.onexit (node:internal/worker:209:20) Emitted 'error' event on Worker instance at: at [kOnExit] (node:internal/worker:287:12) at Worker.<computed>.onexit (node:internal/worker:209:20) { code: 'ERR_WORKER_OUT_OF_MEMORY' } Node.js v18.17.1 ——————————————————————————————————————————————————————————————————————————————————————————————————————————————————————— NX Running target start for project twenty-front and 2 tasks it depends on failed Failed tasks: - twenty-front:start Hint: run the command with --verbose for more details. This is what I got total used free shared buff/cache available Mem: 2.6Gi 743Mi 1.8Gi 12Mi 288Mi 1.9Gi Swap: 1.0Gi 157Mi 866Mi
charles
charles2mo ago
you seem to only have 3GB on your VM, this is too low to run both FE and BE on Twenty 😦
oyiks
oyiks2mo ago
What can I do then?
charles
charles2mo ago
If you can allow more resources to your VM it could be a way. Otherwise you can only work on FE and serving the server in production mode (npx nx run twenty-server:build one time, and then yarn server:start:prod)
oyiks
oyiks2mo ago
How do I allow more resources to my VM? Hi Charles Should I only run the front-end command to start the project?
charles
charles2mo ago
Hi @oyiks, I'm no WSL expert I'm sorry, you'll likely find the answer on the internet 🙂 If you work on FE only you can build your server and serve it in prod mode (will take less memory) and only serve the FE in dev mode so in a terminal: - (npx nx run twenty-server:build, then yarn server:start:prod In another terminal: - npx nx run twenty-front:start and make sure to disable the checkers as mentionned above
oyiks
oyiks2mo ago
Thanks. I did all that and I am having a white screen with nothing in it when I go to localhost:/ *localhost:3001/
Want results from more Discord servers?
Add your server