Frappe.min.js not compiling, so failing to load login screen. How to resolve it?

Hi Folks,

I have installed erpnext on Ubuntu 20.0 and currently using Node 12.x LTS. I am frequently getting below error when i compile the assets using bench build:

     $:~/frappe-bench/apps/frappe$ bench build
    yarn run v1.22.5
    $ FRAPPE_ENV=production node rollup/build.js
    Production mode
    ✔ Built js/moment-bundle.min.js
    ✔ Built js/libs.min.js

    Building frappe assets...

    CompileError: Transforming async functions is not implemented. Use `transforms: { asyncAwait: false }` to skip transformation and disable this error. (16:10)
    12 :   boot: {
    13 :     lang: 'en'
    14 :   },
    15 :   _assets_loaded: [],
    16 :   require: async function(links, callback) {
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ✔ Built js/frappe-web.min.js
    CompileError: Transforming async functions is not implemented. Use `transforms: { asyncAwait: false }` to skip transformation and disable this error. (619:22)
    615 :   get_default_outgoing_email_account_signature: function() {
    616 :     return frappe.db.get_value('Email Account', { 'default_outgoing': 1, 'add_signature': 1 }, 'signature');
    617 :   },
    618 : 
    619 :   setup_earlier_reply: async function() {

Above compilation error is preventing from assets to load for login screen. So i could not login even first time to ERPNext.

I tried using nodejs version 10.x as well, but result is same.

Please suggest how should we go about it, thanks.

1 Like

So folks, it turns out that we need to amend the rollup.js configurations for above hurdle.
Location: FRAPPE_BENCH_PATH+/apps/frappe/rollup/config.js

Find method get_rollup_options_for_js, update block below:

function get_rollup_options_for_js(output_file, input_files) {
//...some code
buble({
			objectAssign: 'Object.assign',
			transforms: {
				dangerousForOf: true,
				classes: false,
				asyncAwait: false, // *This is the line required to be added*
			},
			exclude: [path.resolve(bench_path, '**/*.css'), path.resolve(bench_path, '**/*.less')]
		}),
// ... more code

Rebuild the assets using after changing to frappe-bench directory -

$ bench build
$ bench start

This worked well for me.
I hope it helps somebody like me stuck at this error.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.