/node_modules/XXX/index.js:XXX XXX ??= X;SyntaxError: Unexpected token ‘??=‘

To be honest, this problem is a bit strange. It does not affect the operation but instead runs and submits. If
Insert image description here
this problem is not solved, the code cannot be submitted.

This error is caused by syntax incompatibility. ??= is a relatively new JavaScript syntax, which is the null value merge assignment operator. It is not supported in Node.js versions lower than 15 or in some browsers.

Then after understanding the problem, we will have corresponding solutions.
But actually, I don’t recommend changing your own node version.

We found the index.js file in this directory and the syntax of the error report based on the error report.
Insert image description here
This ??= means that if this thing has no value, it will be assigned a value
. So

this.options.fields ??= {
    
    };

Change to

if (!this.options.fields) {
    
    
  this.options.fields = {
    
    };
}

That’s it, but since the node version does not support the syntax error, we naturally have to change it to avoid reporting errors again. To be honest,
Insert image description here
after the change, I obviously feel that it looks better before the change, but there is nothing we can do after all, we don’t want to touch the node version.

Guess you like

Origin blog.csdn.net/weixin_45966674/article/details/133091628