'compiling js failed react native expected buffer size

My code was working fine and then suddenly start showing error something like this:-

Compiling JS failed: 180820:25:';' expected Buffer size 7070676 starts with:....... and has protection mode(s): r--p

Error Screenshot
Error Screenshot

I tried resetting the cache with

npx react-native start --reset-cache

I am using the latest version of every module in my code the last change is to remove the "AsyncStorage" module.



Solution 1:[1]

After reviewing the change I made, it seems that I used and await call outside an async function, and that's what caused this error.

Solution 2:[2]

try npm cache clean –force or yarn cache clean

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Najib Fadil
Solution 2 Estiven Laferre