Accepted answer

for me, the issue was that vscode had inserted some imports at the top of one of my js files. very odd. these were the lines:

import { tsconstructortype } from '@babel/types';
import { logger } from 'handlebars';


usually you can fix these surprise errors by clearing your cache. run $ expo start --clear.


i had this error because i was trying to use dotenv when i should have been using one of these react-native specific packages. check that all your installed packages are compatible with react native.


i had exactly this issue. visual studio code users, autocomplete will sometimes auto-import modules you have no need for at the top of your file without you noticing. running git diff revealed the following lines i had no memory of every writing at the top of a file i'd worked on:

+import { clearconfigcache } from 'prettier';
+import { createiconsetfromfontello } from 'react-native-vector-icons';

how to avoid:

run git diff and read every single line that follows. the offenders will usually turn up.


if you are importing a module (a functional/class component from another file) in expo react native, be sure to mention "./" in the assets array of the rnpm object in the package.json file like this:

"rnpm": {
    "assets": [

do not try to install "fs" module separately, it would give more errors.


my auto-suggestion accidentally imported this in my file which caused the same problem.

import { status } from "express/lib/response";

i removed and it worked. try to find something in import that should not be there like from backend imports.


one of my node modules is depending on react-native-dotenv, but its code was using old import like import {} from 'react-native-dotenv'. but latest version of dotenv is using import {} from '@env'. fixing this import in the module resolved the problem.

Related Query

More Query from same tag