Debugging Javascript ERPNext

I am new to ERPNext and python but familiar with JS code. Unfortunately with ERPNext I am unable to debug the JS code. The console debugger shows a limited set of JS files. Please help me out with this issue.

A lot of JavaScript is loaded dynamically.
console.log should work! :smile:
And if you’re on chrom{e,ium}, you can click the VM:xxxxx link that takes you to the code from where the log came and set a breakpoint (has helped me a lot).

1 Like

Where to see console.log? What do you mean by click VM:xxxxx on chrome?

Thanks @pdvyas, The trick worked :smile: .

@jof2jc , You can view console.log in the browser console (for chrome ctrl+shift+i).
If you look into console tab you will find log tace like

Uncaught TypeError: Cannot read property ‘grid’ of undefinedrefresh_field @ form.min.js:126set_multiple @ form.min.js:117
erpnext.bom.calculate_rm_cost @ VM112:120
frappe.call.callback @ VM112:79
callback @ desk.min.js:7275
statusCode.200 @ desk.min.js:7277

Just click on that VM:xxxx file it will take you to the code from where the log came.

4 Likes