React Native Expo Can't Find Variable Self

前端 未结 4 1436
庸人自扰
庸人自扰 2021-02-02 02:07

I am suddenly getting this error while creating the new project in expo, when I create any project it loads perfectly and can see the default screen.

When I try to inst

相关标签:
4条回答
  • 2021-02-02 02:55

    one thing I noticed: Due to other dependencies it was not sufficient for me to use the newest expo-release. I also had to switch to Yarn (instead of npm).

    0 讨论(0)
  • 2021-02-02 02:58

    so the answer to that is

    "Yes you have to put it in package.json. Manually, with “yarn add whatwg-fetch@2.0.4.” or with “npm install whatwg-fetch@2.0.4”"

    0 讨论(0)
  • 2021-02-02 02:58

    after doing this I get an error "requiring unknown module "985". If you are sure the module is there, try restarting Metro Bundler. You may also want to run 'yarn', or 'npm install'" I've done both of these things but still get the error. Anyone see this?

    edit: resolved. closed out all of the files and restarted my phone. error went away.

    0 讨论(0)
  • 2021-02-02 03:02

    For users creating new project with expo-cli or XDE, you will get red screen “Can’t Find Variable Self” after your first “yarn” or “npm install”. This is because of new “whatwg-fetch” 3.0.0 published yesterday (https://www.npmjs.com/package/whatwg-fetch 23). So you just need to force dependency to previous version: "whatwg-fetch": "^2.0.4" It means put it in package.json as “dependency”. Manually, with “yarn add whatwg-fetch@2.0.4.” Or with “npm add whatwg-fetch@2.0.4”.

    Everything should now work like a charm.

    Hope this helps ;p

    Links:

    • Can't find variable : Self / Can't install firebase

    • https://forums.expo.io/t/cant-find-variable-self/13547

    Up: expo@30.0.1 added whatwg-fetch@2.0.4 as dependency. Problem is gone ;)

    0 讨论(0)
提交回复
热议问题