0

Expo-notifications config plugin error in Expo project: I'm working on an Expo project, and I encountered the error message "Package 'expo-notifications' does not contain a valid config plugin." I've checked the package installation and compatibility, but the error persists. Has anyone else encountered this issue, and what could be causing it?

When I run npx expo prebuild I got this error When I run npx eas build show same error.

Starting project at D:\Projects\GoalSettingApp\client
PluginError: Package "expo-notifications" does not contain a valid config plugin.
Learn more: https://docs.expo.dev/guides/config-plugins/#creating-a-plugin

Unexpected token 'export'
D:\Projects\...\client\node_modules\expo-notifications\build\index.js:1
export { default as getDevicePushTokenAsync } from './getDevicePushTokenAsync';
^^^^^^

SyntaxError: Unexpected token 'export'
    at Object.compileFunction (node:vm:360:18)
    at wrapSafe (node:internal/modules/cjs/loader:1088:15)
    at Module._compile (node:internal/modules/cjs/loader:1123:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
    at Module.load (node:internal/modules/cjs/loader:1037:32)
    at Module._load (node:internal/modules/cjs/loader:878:12)
    at Module.require (node:internal/modules/cjs/loader:1061:19)
    at require (node:internal/modules/cjs/helpers:103:18)
    at requirePluginFile (D:\Projects\...\client\node_modules\@expo\config-plugins\build\utils\plugin-resolver.js:214:12)
    at resolveConfigPluginFunctionWithInfo (D:\Projects\...\client\node_modules\@expo\config-plugins\build\utils\plugin-resolver.js:155:14)

This is my babe.config.js

module.exports = function(api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo'],
    plugins: [
      'react-native-reanimated/plugin'
    ],
  };
};

This is my package.json

{
  "name": "client",
  "version": "1.0.0",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web"
  },
  "dependencies": {
    "@babel/preset-env": "^7.1.6",
    "@expo/vector-icons": "^13.0.0",
    "@react-native-async-storage/async-storage": "1.17.11",
    "@react-native-community/datetimepicker": "6.7.3",
    "@react-native-community/slider": "^4.4.2",
    "@react-navigation/bottom-tabs": "^6.5.8",
    "@react-navigation/drawer": "^6.6.3",
    "@react-navigation/native": "^6.1.7",
    "@react-navigation/native-stack": "^6.9.13",
    "@react-navigation/stack": "^6.3.17",
    "@reduxjs/toolkit": "^1.9.5",
    "axios": "^1.4.0",
    "expo": "^49.0.6",
    "expo-av": "~13.2.1",
    "expo-constants": "~14.2.1",
    "expo-device": "~5.2.1",
    "expo-linear-gradient": "~12.1.2",
    "expo-media-library": "~15.2.3",
    "expo-modules-autolinking": "^0.8.1",
    "expo-notifications": "^0.8.2",
    "expo-splash-screen": "^0.20.5",
    "expo-status-bar": "~1.4.4",
    "react": "18.2.0",
    "react-native": "0.71.8",
    "react-native-gesture-handler": "~2.9.0",
    "react-native-modal-datetime-picker": "^17.0.0",
    "react-native-qrcode-svg": "^6.2.0",
    "react-native-reanimated": "~2.14.4",
    "react-native-safe-area-context": "4.5.0",
    "react-native-screens": "~3.20.0",
    "react-native-svg": "13.4.0",
    "react-native-switch-selector": "^2.3.0",
    "react-native-vector-icons": "^10.0.0",
    "react-redux": "^8.1.1",
    "recyclerlistview": "^4.2.0",
    "uuid": "^9.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0"
  },
  "private": true
}

This is plugins in app.json

      [
        "expo-notifications",
        {
          "icon": "./assets/icon.png",
          "color": "#ffffff"
        }
      ]
    ],```

What I need to change my code so that the error no longer occur?

1 Answers1

0

Actually I am using wrong version of expo-notifications. I should use ^0.18.2 instead of ^0.8.2.

If Anyone is facing same issue, consider checking your package version.