react-native-decompiler icon indicating copy to clipboard operation
react-native-decompiler copied to clipboard

Error parsing JS, unexpected character

Open MiguelAngelLV opened this issue 2 years ago • 1 comments

Describe the bug

While try decompile a bundle, I get this error

[miguel@Hyrule assets]$ npx react-native-decompiler -i index.android.bundle -o ./output
Reading file...
Parsing JS...
[!] Error occurred! You should probably report this.
SyntaxError: Unexpected character '�' (1:0)
    at Parser._raise (/home/miguel/.npm/_npx/4e4fd7975998532f/node_modules/@babel/parser/lib/index.js:748:17)
    at Parser.raiseWithData (/home/miguel/.npm/_npx/4e4fd7975998532f/node_modules/@babel/parser/lib/index.js:741:17)
    at Parser.raise (/home/miguel/.npm/_npx/4e4fd7975998532f/node_modules/@babel/parser/lib/index.js:735:17)
    at Parser.getTokenFromCode (/home/miguel/.npm/_npx/4e4fd7975998532f/node_modules/@babel/parser/lib/index.js:8423:16)
    at Parser.nextToken (/home/miguel/.npm/_npx/4e4fd7975998532f/node_modules/@babel/parser/lib/index.js:7889:12)
    at Parser.parse (/home/miguel/.npm/_npx/4e4fd7975998532f/node_modules/@babel/parser/lib/index.js:13413:10)
    at Object.parse (/home/miguel/.npm/_npx/4e4fd7975998532f/node_modules/@babel/parser/lib/index.js:13468:38)
    at ReactNativeSingleParser.parse (/home/miguel/.npm/_npx/4e4fd7975998532f/node_modules/react-native-decompiler/out/fileParsers/reactNativeSingleParser.js:54:29)
    at async start (/home/miguel/.npm/_npx/4e4fd7975998532f/node_modules/react-native-decompiler/out/main.js:81:25) {
  loc: Position { line: 1, column: 0 },
  pos: 0
}

To Reproduce

Normal use

Expected behavior Decompile the file

Actual behavior Get a error parsing file

Additional context I use Manjaro Linux.

MiguelAngelLV avatar May 20 '22 07:05 MiguelAngelLV

Same here the beginning of the files have binary stuff and starts in line 620 with var BUNDLE_START_TIME=..... Removing the binary text will help but it decompiles only 7 files https://mega.nz/file/NW12GS4B#RA1aMKeZO7QHvu3Mibjz5owyXYmj2C5o4y5rIFu-Kz8

TA2k avatar May 31 '22 11:05 TA2k