Memory limit error when running project

No description
51 Replies
martmull
martmull2w ago
hey @shyamsundertard, what command did you run?
shyamsundertard
npx nx start
martmull
martmull2w ago
can you past the full error please?
shyamsundertard
Ok
martmull
martmull2w ago
thanks I need to check which subcommand is failing
shyamsundertard
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
martmull2w ago
there is nothing above that ?
shyamsundertard
Above code have no error, that code comes after running "npx nx start", and giving no errors
martmull
martmull2w ago
please paste all
shyamsundertard
But when the web starts to load it gives that error, then on web I get "This site can't be reached" Ok
martmull
martmull2w ago
Thanks, may not be useful but i would like to be sure
martmull
martmull2w ago
thanks, looking at it
shyamsundertard
ok,thanks
martmull
martmull2w ago
what ram memory does your macbookair have?
shyamsundertard
8GB
martmull
martmull2w 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
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
martmull2w ago
ok, so the twenty-front:start command is the issue
shyamsundertard
yes
charles
charles2w 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
I am not using docker or any any vm, just using postgres in my device itself, it has 8/256 RAM/ROM
charles
charles2w 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
which env variables? As per project setup I pasted from .env.example to their respective .env
charles
charles2w ago
VITE_DISABLE_TYPESCRIPT_CHECKER=true and VITE_DISABLE_ESLINT_CHECKER=true in packages/twenty-front/.env
shyamsundertard
Thanks, now working without error. Thanks @charles and @martmull
martmull
martmull2w ago
With pleasure, happy it works 🤗
oyiks
oyiks7d 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
Have to made above discussed changes ?
oyiks
oyiks7d ago
I need help to make it work.
charles
charles7d ago
yes, it will help a lot!
oyiks
oyiks7d 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
@oyiks Also go to packages/twnety-front/package.json and in that change 3000 with 4096 as it will increase memory size
oyiks
oyiks7d ago
Alright then.
charles
charles7d ago
how much RAM do you have?
oyiks
oyiks7d ago
6gb RAM.
charles
charles7d 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
oyiks7d ago
Alright then. I am using WSL on windows.
charles
charles7d ago
Okay and 6gb is the ram of your linux VM right? not your Windows host
oyiks
oyiks7d 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
In build replace 3000 by 4096
oyiks
oyiks7d ago
Done. I can run npx nx start now right?
charles
charles7d ago
How much do you have on your LInux vm?
oyiks
oyiks6d 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
charles6d ago
you seem to only have 3GB on your VM, this is too low to run both FE and BE on Twenty 😦
oyiks
oyiks6d ago
What can I do then?
charles
charles6d 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
oyiks6d 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
charles5d 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
oyiks3d 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