Generating JavaScript bundles failed - app.js from Terser

So, I took a look at this since Perry pointed out that you’d get quicker help in the helpdesk and wanted to try to unblock you before the weekend!

The Business level accounts don’t have any more build resources than the Pro (or free) account levels, so let me know if you’d like my help downgrading and getting a refund for that since it wouldn’t help.

I see you say the build does work locally which is a great start! Some suggestions to make sure our build is the same as yours are in this article: [Support Guide] Debugging Netlify site builds (for instance: I see you say you’re on the same node version that we use in that build - but what about yarn?)

I also see that you have a yarn.lock - so we install your modules using yarn:

…but then you run your build with npm. Is there a reason for this? It’s not usual to mix the two…if you want us to install with npm instead of yarn you can either remove yarn.lock from your repo or set $NETLIFY_USE_YARN to false as described here: Manage build dependencies | Netlify Docs

Another trick that you can use to try to understand more about the nature of the failure (this is not one I’ve seen before and I’ve debugged over 10,000 builds in the past 4 years), would be to show the npm debug log. Since the filename changes every time, and we want to make sure your bad deploy doesn’t get published, we have to get a bit tricky to show it!

This pattern should work:

assume your normal build command is npm run build (I know, yours is about 8 commands, but I’m not sharing them here, the advice will remain the same). To show the error file AND still fail the deploy, this is the change you’d make:

append this to it:

; cat /opt/buildhome/.npm/_logs/*-debug.log ; sleep 100 ; false

that will show the log, give our system time to save it, and then fail the deploy. Hopefully the info in there is helpful to you in resolving the root cause!

1 Like