LiquidPlayer / LiquidCore

Node.js virtual machine for Android and iOS
MIT License
1.01k stars 127 forks source link

Android build fails after including AWS Amplify node module #200

Open JaspreetDev opened 3 years ago

JaspreetDev commented 3 years ago

OS: Linux Mint 20 LiquidCore: 0.7.10 Android Studio: 4.1.1 Android API: 30

I've successfully tested LiquidCore without adding any major node modules. Everything works fine till I require aws-amplify module. When I try to build the app on Android Studio, the build fails with the following,

> Task :app:bundleLiquidCoreCode

               ######                ######               
             ###     ####        ####     ###             
            ##          ###    ###          ##            
            ##             ####             ##            
            ##             ####             ##            
            ##           ##    ##           ##            
            ##         ###      ###         ##            
             ##  ########################  ##             
          ######    ###            ###    ######          
      ###     ##    ##              ##    ##     ###      
   ###         ## ###      ####      ### ##         ###   
  ##           ####      ########      ####           ##  
 ##             ###     ##########     ###             ## 
  ##           ####      ########      ####           ##  
   ###         ## ###      ####      ### ##         ###   
      ###     ##    ##              ##    ##     ###      
          ######    ###            ###    ######          
             ##  ########################  ##             
            ##         ###      ###         ##            
            ##           ##    ##           ##            
            ##             ####             ##            
            ##             ####             ##            
            ##          ###    ###          ##            
             ###     ####        ####     ###             
               ######                ######               

                  Welcome to React Native!
                 Learn once, write anywhere

WARN: Cannot resolve module './zlib_bindings'.  This will throw an Error at runtime.
{ SyntaxError: /home/antisaby/Projects/Android/LiquidTest/node_modules/react-native/index.js: Unexpected token, expected "{" (13:7)

  11 | 'use strict';
  12 | 
> 13 | import typeof AccessibilityInfo from './Libraries/Components/AccessibilityInfo/AccessibilityInfo';
     |        ^
  14 | import typeof ActivityIndicator from './Libraries/Components/ActivityIndicator/ActivityIndicator';
  15 | import typeof Button from './Libraries/Components/Button';
  16 | import typeof CheckBox from './Libraries/Components/CheckBox/CheckBox';
    at Parser._raise (/home/antisaby/Projects/Android/LiquidTest/node_modules/@babel/parser/lib/index.js:748:17)
    at Parser.raiseWithData (/home/antisaby/Projects/Android/LiquidTest/node_modules/@babel/parser/lib/index.js:741:17)
    at Parser.raise (/home/antisaby/Projects/Android/LiquidTest/node_modules/@babel/parser/lib/index.js:735:17)
    at Parser.unexpected (/home/antisaby/Projects/Android/LiquidTest/node_modules/@babel/parser/lib/index.js:9097:16)
    at Parser.expect (/home/antisaby/Projects/Android/LiquidTest/node_modules/@babel/parser/lib/index.js:9083:28)
    at Parser.parseNamedImportSpecifiers (/home/antisaby/Projects/Android/LiquidTest/node_modules/@babel/parser/lib/index.js:13233:10)
    at Parser.parseImport (/home/antisaby/Projects/Android/LiquidTest/node_modules/@babel/parser/lib/index.js:13078:39)
    at Parser.parseStatementContent (/home/antisaby/Projects/Android/LiquidTest/node_modules/@babel/parser/lib/index.js:11750:27)
    at Parser.parseStatement (/home/antisaby/Projects/Android/LiquidTest/node_modules/@babel/parser/lib/index.js:11650:17)
    at Parser.parseBlockOrModuleBlockBody (/home/antisaby/Projects/Android/LiquidTest/node_modules/@babel/parser/lib/index.js:12232:25)
  type: 'TransformError',
  snippet: undefined,
  lineNumber: 13,
  column: 7,
  filename: 'node_modules/react-native/index.js' }

> Task :app:bundleLiquidCoreCode FAILED

Execution failed for task ':app:bundleLiquidCoreCode'.
> Process 'command 'node'' finished with non-zero exit value 254

I have tried disabling/enabling minify in package.json but no success.

ericwlange commented 3 years ago

There are two problems here. The error is coming because the import typeof syntax is not understood by the version of the packager it seems. It may require some preprocessing first.

The second will happen at runtime if it tries to load the zlib_bindings, which is a native c++ node binding. This is not supported. This may or not be an issue depending on how it is used.

On Fri, Dec 4, 2020, 6:54 PM Jaspreet Singh notifications@github.com wrote:

OS: Linux Mint 20 LiquidCore: 0.7.10 Android Studio: 4.1.1 Android API: 30

I've successfully tested LiquidCore without adding any major node modules. Everything works fine till I require aws-amplify module. When I try to build the app on Android Studio, the build fails with the following,

Task :app:bundleLiquidCoreCode

           ######                ######
         ###     ####        ####     ###
        ##          ###    ###          ##
        ##             ####             ##
        ##             ####             ##
        ##           ##    ##           ##
        ##         ###      ###         ##
         ##  ########################  ##
      ######    ###            ###    ######
  ###     ##    ##              ##    ##     ###

  ###     ##    ##              ##    ##     ###
      ######    ###            ###    ######
         ##  ########################  ##
        ##         ###      ###         ##
        ##           ##    ##           ##
        ##             ####             ##
        ##             ####             ##
        ##          ###    ###          ##
         ###     ####        ####     ###
           ######                ######

              Welcome to React Native!
             Learn once, write anywhere

WARN: Cannot resolve module './zlib_bindings'. This will throw an Error at runtime. { SyntaxError: /home/antisaby/Projects/Android/LiquidTest/node_modules/react-native/index.js: Unexpected token, expected "{" (13:7)

11 | 'use strict'; 12 |

13 | import typeof AccessibilityInfo from './Libraries/Components/AccessibilityInfo/AccessibilityInfo'; | ^ 14 | import typeof ActivityIndicator from './Libraries/Components/ActivityIndicator/ActivityIndicator'; 15 | import typeof Button from './Libraries/Components/Button'; 16 | import typeof CheckBox from './Libraries/Components/CheckBox/CheckBox'; at Parser._raise (/home/antisaby/Projects/Android/LiquidTest/node_modules/@babel/parser/lib/index.js:748:17) at Parser.raiseWithData (/home/antisaby/Projects/Android/LiquidTest/node_modules/@babel/parser/lib/index.js:741:17) at Parser.raise (/home/antisaby/Projects/Android/LiquidTest/node_modules/@babel/parser/lib/index.js:735:17) at Parser.unexpected (/home/antisaby/Projects/Android/LiquidTest/node_modules/@babel/parser/lib/index.js:9097:16) at Parser.expect (/home/antisaby/Projects/Android/LiquidTest/node_modules/@babel/parser/lib/index.js:9083:28) at Parser.parseNamedImportSpecifiers (/home/antisaby/Projects/Android/LiquidTest/node_modules/@babel/parser/lib/index.js:13233:10) at Parser.parseImport (/home/antisaby/Projects/Android/LiquidTest/node_modules/@babel/parser/lib/index.js:13078:39) at Parser.parseStatementContent (/home/antisaby/Projects/Android/LiquidTest/node_modules/@babel/parser/lib/index.js:11750:27) at Parser.parseStatement (/home/antisaby/Projects/Android/LiquidTest/node_modules/@babel/parser/lib/index.js:11650:17) at Parser.parseBlockOrModuleBlockBody (/home/antisaby/Projects/Android/LiquidTest/node_modules/@babel/parser/lib/index.js:12232:25) type: 'TransformError', snippet: undefined, lineNumber: 13, column: 7, filename: 'node_modules/react-native/index.js' }

Task :app:bundleLiquidCoreCode FAILED

Execution failed for task ':app:bundleLiquidCoreCode'.

Process 'command 'node'' finished with non-zero exit value 254

I have tried disabling/enabling minify in package.json but no success.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/LiquidPlayer/LiquidCore/issues/200, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJC4ZBNSAGDFMTHDF3JWJDSTEO5TANCNFSM4UNYJJSA .

JaspreetDev commented 3 years ago

@ericwlange Thank you for getting back to me. The same setup works just fine if I exclude the aws-amplify require and the packager picks up the import statements just fine.