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

Compiling JS failed: 28252:33:'{' expected in function expression Buffer size 5748458 starts with: 766172205f5f42554e444c455f535441

Open keerthika-priya opened this issue 3 years ago • 24 comments

New Version

0.70.4

Old Version

0.61.2

Build Target(s)

iOS simulator debug

Output of react-native info

info Fetching system and libraries information... (node:17510) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency (Use node --trace-warnings ... to show where the warning was created) System: OS: macOS 12.6.1 CPU: (10) arm64 Apple M1 Pro Memory: 107.89 MB / 16.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 16.15.1 - ~/.nvm/versions/node/v16.15.1/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 8.11.0 - /opt/homebrew/bin/npm Watchman: 2022.11.14.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0 Android SDK: Not Found IDEs: Android Studio: Not Found Xcode: 14.0/14A309 - /usr/bin/xcodebuild Languages: Java: Not Found npmPackages: @react-native-community/cli: Not Found react: 18.1.0 => 18.1.0 react-native: 0.70.4 => 0.70.4 react-native-macos: Not Found npmGlobalPackages: react-native: Not Found

Issue and Reproduction Steps

I am facing the following issue after upgrading to RN 0.70.4 Compiling JS failed: 28252:33:'{' expected in function expression Buffer size 5748458 starts with: 766172205f5f42554e444c455f535441

keerthika-priya avatar Dec 12 '22 18:12 keerthika-priya

I have same issues.

"react": "18.1.0",
"react-native": "0.70.6",
System:
    OS: macOS 12.5.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 1.01 GB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.11.0 - /opt/homebrew/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 8.19.2 - /opt/homebrew/bin/npm
    Watchman: Not Found
  Managers:
    CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 21.4, iOS 16.0, macOS 12.3, tvOS 16.0, watchOS 9.0
    Android SDK: Not Found
  IDEs:
    Android Studio: 2021.2 AI-212.5712.43.2112.8609683
    Xcode: 14.0.1/14A400 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.11 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.1.0 => 18.1.0 
    react-native: 0.70.6 => 0.70.6 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

luutruong avatar Dec 17 '22 13:12 luutruong

does it has solution

thanggggg1 avatar Dec 22 '22 03:12 thanggggg1

Same issue with "react-native": "^0.70.5" Please suggest some solutions

krushalikevadiya avatar Jan 18 '23 11:01 krushalikevadiya

I'm getting the same, does it has solution?

dhayaljaswantgit avatar Jan 18 '23 19:01 dhayaljaswantgit

I have created new project and moved all the code into newly created project.

krushalikevadiya avatar Jan 19 '23 08:01 krushalikevadiya

I ran into this issue, however for me it was caused by upgrading metro-react-native-babel-preset from 0.73.7 to 0.74.0 (with react-native 0.70.5 & 0.70.6). Changing it back to 0.73.7 resolved the issue for me.

bradydoll avatar Jan 24 '23 23:01 bradydoll

changing the version to 0.73.7 of package metro-react-native-babel-preset resolved the issue for me

belkhoujaons avatar Feb 22 '23 14:02 belkhoujaons

I also had this problem until I realized that I had imported and used a json file, but it was empty.

sajadspeed avatar Jun 10 '23 12:06 sajadspeed

@sajadspeed How did you find out which JSON file was empty? I'm experiencing the same issue, but I didn't add any JSON file within my app. However, I did update several libraries

novejero95 avatar Jun 27 '23 21:06 novejero95

I've got the same issue because I've been missing a curly bracket in one of my json translation files, fixing the file resolved the issue.

Bar-Maz avatar Jun 27 '23 23:06 Bar-Maz

@sajadspeed How did you find out which JSON file was empty? I'm experiencing the same issue, but I didn't add any JSON file within my app. However, I did update several libraries

This was just my problem, this error may occur for other reasons.

sajadspeed avatar Jun 28 '23 12:06 sajadspeed

this is due to importing an empty json file!

24greyhat avatar Jul 13 '23 19:07 24greyhat

happens after adding reanimated library, In my case, it's a conflict between gesture-handler and reanimated versions

I manually found reanimated version which is compatible with my gesture-handler version

"react-native-gesture-handler": "2.12.1",
"react-native-reanimated": "3.3.0",

vemarav avatar Aug 13 '23 18:08 vemarav

I think I have found a normal solution to this problem. I was getting exactly the same error. It's trite when starting and compiling an empty project. decision: You have a shortage of RAM memory and processor power. You need to close all unnecessary applications on the PC so that React Native can compile the application. When I tried to compile the application, my CPU was 85% busy, but I closed all unnecessary applications on the PC, now my processor was running at 8%. I only had VS Code open, and I tried to recompile the project. Everything went well. In my case, the problem was a lack of RAM and a lack of free processor power.

suprunchuk avatar Sep 13 '23 08:09 suprunchuk

I think I have found a normal solution to this problem. I was getting exactly the same error. It's trite when starting and compiling an empty project. decision: You have a shortage of RAM memory and processor power. You need to close all unnecessary applications on the PC so that React Native can compile the application. When I tried to compile the application, my CPU was 85% busy, but I closed all unnecessary applications on the PC, now my processor was running at 8%. I only had VS Code open, and I tried to recompile the project. Everything went well. In my case, the problem was a lack of RAM and a lack of free processor power.

This was the issue for me. Thanks.

majidalykhan avatar Sep 27 '23 20:09 majidalykhan

I think I have found a normal solution to this problem. I was getting exactly the same error. It's trite when starting and compiling an empty project. decision: You have a shortage of RAM memory and processor power. You need to close all unnecessary applications on the PC so that React Native can compile the application. When I tried to compile the application, my CPU was 85% busy, but I closed all unnecessary applications on the PC, now my processor was running at 8%. I only had VS Code open, and I tried to recompile the project. Everything went well. In my case, the problem was a lack of RAM and a lack of free processor power.

This was the issue for me too. Thank you

sriharsha-bhasuru avatar Oct 30 '23 16:10 sriharsha-bhasuru

this is due to importing an empty json file!

I confirm, in my project this issue was due to requiring an empty .json file.

dukoo avatar Nov 06 '23 14:11 dukoo

In my case the problem was caused by using a Typescript feature not supported by the version used by the project.

If you are using VS Code, you can make it use the workspace version by calling the Typescript: Select Typescript Version command. This way it prevents you from using unsupported features.

sntg-p avatar Nov 30 '23 20:11 sntg-p

I ran into this issue, however for me it was caused by upgrading metro-react-native-babel-preset from 0.73.7 to 0.74.0 (with react-native 0.70.5 & 0.70.6). Changing it back to 0.73.7 resolved the issue for me.

How do I check for compatible packages and make sure they align?

MbongeniMM avatar Feb 17 '24 20:02 MbongeniMM

are issue resolved and how? i have a some problem

harutyunian avatar Mar 05 '24 20:03 harutyunian

are issue resolved and how? i have a some problem

@harutyunian I still have the same issue, however I started using my physical device instead of Android studio and that works perfectly. Just need to make sure that your expo version on your physical device is the same as the one in your dependencies

MbongeniMM avatar Mar 06 '24 09:03 MbongeniMM

i have that issue on my macbook but after restarting computer its fixed, here is my babel configs module.exports = function(api) { api.cache(true); return { presets: ["module:metro-react-native-babel-preset"], plugins: ['react-native-reanimated/plugin', ] }; };

harutyunian avatar Mar 07 '24 08:03 harutyunian

Happened to me today, restarting my pc solved it.

A-AllaaEddine avatar Apr 06 '24 09:04 A-AllaaEddine

Aconteceu comigo hoje, reiniciar meu pc resolveu.

Eu estou tendo esse problema depois que fui para o Windows, não acontecia comigo quando eu utilizava o Linux. Quando isso acontece, eu excluo o meu device emulator e crio novamente.

mateusmatosleonardo avatar May 14 '24 01:05 mateusmatosleonardo