Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React Native Expo Can't Find Variable Self

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 install any dependancy e.g. yarn add native-base it stops working and giving me can't Find Variable Self and Expo gets hanged

Please help thanks in advance

like image 253
Kedar Dave Avatar asked Sep 11 '18 06:09

Kedar Dave


1 Answers

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 [email protected].” Or with “npm add [email protected]”.

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: [email protected] added [email protected] as dependency. Problem is gone ;)

like image 50
Florian Bonniec Avatar answered Oct 16 '22 10:10

Florian Bonniec