Getting "Couldn't get GCM token" on Windows expo client

Hello, I need some help with getting the Device token and while I know this error has been discussed a lot in the forums, please note that mine is a very particular case.

I am testing the same app with the same expo-client version (2.2.0) and sdk (29) on two different environments (osx and windows) and is giving me two different outcomes. While it works for OSX, I am getting the GCM token error on Windows:

// Get Expo push notification token
let expoPushToken = await Notifications.getExpoPushTokenAsync();
console.log("Token: ", expoPushToken);

I haven’t changed anything, same codebase and made sure to install the same expo-cli version as well. Having said that, I have scoured the forums once more to make sure I haven’t missed anything recent but found no answer to my problem.

package.json:

{
  "name": "empty-project-template",
  "main": "node_modules/expo/AppEntry.js",
  "private": true,
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject",
    "postinstall": "rndebugger-open --expo"
  },
  "dependencies": {
    "axios": "^0.18.0",
    "expo": "^29.0.0",
    "moment": "^2.22.2",
    "react": "16.3.1",
    "react-native": "https://github.com/expo/react-native/archive/sdk-29.0.0.tar.gz",
    "react-native-elements": "^0.19.1",
    "react-native-geocoding": "^0.3.0",
    "react-navigation": "^2.11.2",
    "react-redux": "^5.0.7",
    "redux": "^4.0.0",
    "redux-thunk": "^2.3.0"
  },
  "devDependencies": {
    "react-native-debugger-open": "^0.3.17"
  }
}

expo client

 james@PROBOOK  ~  expo --version
2.2.0

After hours troubleshooting, I found an unorthodox way of fixing this issue. Will explain as it might help others.

I removed the node_modules folder and re-installed the npm modules again. I have also repeated the Expo FCM steps again, followed by an expo build and upload of the API key. Then I did the expo start again and this time worked. I suspect that the re-installation of the npm modules did the trick.

Interesting. Thanks for sharing your findings. I’m guessing you’re right regarding the deleting/re-installing of node_modules.

Cheers,

Adam

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.