score:22

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';

score:0

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

score:0

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.

score:0

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.

score:0

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.

score:0

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.

score:6

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