Stuck on building frappe assets

I’m running frappe/erpnext in my vps which have 1 core and 1GB ram. The system running extremly smooth and fast before, however recently I face a strange thing, after running bench update command, it stucks on building frappe assets, and at the same time the cpu will be overloaded and you can’t connect through the vps. I need to manually restart the vps, but since the assets are not build completely, some UI features are failed.

yarn install v1.13.0
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.85s.
Backing up sites...
Patching sites...
Migrating site1.local
Updating DocTypes for frappe        : [========================================]
Updating DocTypes for erpnext       : [========================================]
yarn run v1.13.0
$ FRAPPE_ENV=production node rollup/build.js
Production mode
✔ Built js/moment-bundle.min.js
✔ Built js/libs.min.js

Building frappe assets...

I also tried to only rebuild the css/js by using bench update --build, it will stuck on same place.

yarn run v1.13.0
$ FRAPPE_ENV=production node rollup/build.js
Production mode
✔ Built js/moment-bundle.min.js
✔ Built js/libs.min.js

Building frappe assets...

Is there anything I can do to rebuild css/js file?

Have you checked this?
https://frappe.io/docs/user/en/bench/resources/bench-commands-cheatsheet

bench update --build

I tried this command, but stuck on the same line

Building frappe assets...

That’s the one that should be logical. What about this:
bench migrate

yarn install v1.13.0
[1/4] Resolving packages...
success Already up-to-date.
Done in 0.71s.
Backing up sites...
Patching sites...
Migrating site1.local
Updating DocTypes for frappe        : [========================================]
Updating DocTypes for erpnext       : [========================================]
yarn run v1.13.0
$ FRAPPE_ENV=production node rollup/build.js
Production mode
✔ Built js/moment-bundle.min.js
✔ Built js/libs.min.js

Building frappe assets...

✔ Built js/print_format_v3.min.js
✔ Built js/dialog.min.js
✔ Built js/web_form.min.js
✔ Built js/form.min.js
✔ Built js/list.min.js
✔ Built js/chat.js
✔ Built js/desk.min.js
✔ Built css/frappe-rtl.css
✔ Built css/form.min.css
✔ Built css/list.min.css
✔ Built css/module.min.css
✔ Built frappe/css/email.css
✔ Built css/report.min.css
✔ Built css/web_form.css
✔ Built css/frappe-web.css
✔ Built css/desk.min.css
✔ Built js/control.min.js
✔ Built js/frappe-web.min.js
✔ Built js/report.min.js
✨  Done in 22072.999s

Building erpnext assets...

✔ Built js/erpnext-web.min.js
✔ Built js/item-dashboard.min.js
✔ Built js/erpnext.min.js
✔ Built css/erpnext-web.css
✔ Built css/erpnext.css
✔ Built css/marketplace.css
✔ Built js/marketplace.min.js
✨  Done in 23.258s

I started a screen conversation in the background yesterday, and I just checked, it took 22072.999s to finsh building frappe assets. But the building process is still not finished, and CPU usage is still around 99%~100%.

just a shot in the dark.

can it be you willingly or unwillingly upgraded to v11 by the bench update and 1 core and 1GB ram (which is below what I have heard most of the time when it comes to recommending horsepower for ERPNext) just not do the lifting anymore on v11?

If you haven’t done this already, make sure that bench isnt running (I.e. that you can’t access the site), then run bench build.

I know this is old, but for someone else these days that is having this issue:
I use a AWS t2.small, with 2GB ram, and it was taking very long to build the assets (More than 2 hours and not done yet).
I decided to look into the matter and I solved it by increasing my 512MB of swap space to 2GB swap space.
After that change, building the assets took just a few minutes.