There are many #netlify-support:support-guides here such as [Support Guide] Debugging Netlify site builds and memory-specific ones like [Support Guide] Making sure your builds use appropriate resources for Netlify's build system and [Support Guide] What can I do if my build fails for memory-overallocation-related errors? (assuming memory is the issue.)
If you can share your git repository, the community can possibly provide more relevant assistance.