cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Build failed Unhandled AST node type ChainExpression Node error

2,566

I am trying to build a SapUI5 app in BAS and it was working fine all this time but now started failing with the following error.

If I commented out all the code in controller then the build get stuck in generateComponentPreload task.

info builder:builder Building project com.acm.inspection not including dependencies...<br>info builder:builder ��  (1/1) Building project com.acm.inspection<br>info builder:builder application com.acm.inspection �� (1/8) Running task escapeNonAsciiCharacters...<br>info builder:builder application com.acm.inspection �� (2/8) Running task replaceCopyright...<br>info builder:builder application com.acm.inspection �� (3/8) Running task replaceVersion...<br>info builder:builder application com.acm.inspection �� (4/8) Running task generateFlexChangesBundle...<br>info builder:builder application com.acm.inspection �� (5/8) Running task generateComponentPreload...<br>[  ................] \ : info builder:builder application com.acm.inspection �� (5/8) Running task generateComponentPreload...

And If I do not comment out the code then I am getting Unhandled AST node type ChainExpression.

ERR! lbt:analyzer:JSModuleAnalyzer Unhandled AST node type ChainExpression Node {<br>ERR! lbt:analyzer:JSModuleAnalyzer   type: 'ChainExpression',<br>ERR! lbt:analyzer:JSModuleAnalyzer   start: 3286,<br>ERR! lbt:analyzer:JSModuleAnalyzer   end: 3314,<br>ERR! lbt:analyzer:JSModuleAnalyzer   expression: Node {<br>ERR! lbt:analyzer:JSModuleAnalyzer     type: 'CallExpression',<br>ERR! lbt:analyzer:JSModuleAnalyzer     start: 3286,<br>ERR! lbt:analyzer:JSModuleAnalyzer     end: 3314,<br>ERR! lbt:analyzer:JSModuleAnalyzer     callee: Node {<br>ERR! lbt:analyzer:JSModuleAnalyzer       type: 'MemberExpression',<br>ERR! lbt:analyzer:JSModuleAnalyzer       start: 3286,<br>ERR! lbt:analyzer:JSModuleAnalyzer       end: 3312,<br>ERR! lbt:analyzer:JSModuleAnalyzer       object: [Node],<br>ERR! lbt:analyzer:JSModuleAnalyzer       property: [Node],<br>ERR! lbt:analyzer:JSModuleAnalyzer       computed: false,<br>ERR! lbt:analyzer:JSModuleAnalyzer       optional: true<br>ERR! lbt:analyzer:JSModuleAnalyzer     },<br>ERR! lbt:analyzer:JSModuleAnalyzer     arguments: [],<br>ERR! lbt:analyzer:JSModuleAnalyzer     optional: false<br>ERR! lbt:analyzer:JSModuleAnalyzer   }<br>ERR! lbt:analyzer:JSModuleAnalyzer }<br>ERR! lbt:resources:ResourcePool failed to analyze ....: Error: Unhandled AST node type ChainExpression<br>ERR! lbt:resources:ResourcePool     at visit (/home/user/projects/..../node_modules/@ui5/cli/node_modules/@ui5/builder/lib/lbt/analyzer/JSModuleAnalyzer.js:506:12)

Accepted Solutions (0)

Answers (2)

Answers (2)

pek
Explorer
0 Kudos

This issue has been solved in the next major version.

Update your ui5 cli to version 3.0.0:

npm i --save-dev @ui5/cli@latest

https://sap.github.io/ui5-tooling/v3/updates/migrate-v3/

0 Kudos

Seems like the build process currently does not support optional chaining (AKA null conditional operator):

var value = ObjectName?.PropertyName;

Try to replace the ?. operator, i.e. like so:

var value = ObjectName ? ObjectName.PropertyName : null;
pek
Explorer
0 Kudos

As discussed in this issue this was resolved in version 3.0.0 of the ui5 cli:

https://github.com/SAP/ui5-tooling/issues/575

Updating will help:

npm i --save-dev @ui5/cli@latest

See here for migrating to v3: https://sap.github.io/ui5-tooling/v3/updates/migrate-v3/