'Error: "Package firebase-functions has been ignored because it contains invalid configuration" - only occurs on Mac M1, not on Windows

When I try to build my react native app in both android and ios on my Mac M1, I get this error.....it does not occur when I build on Windows:

Package firebase-functions has been ignored because it contains invalid configuration. Reason: Package subpath './package.json' is not defined by "exports" in /Users/..../node_modules/firebase-functions/package.json

I took a look into my node modules folder, and at there is indeed a package.json file at the path node_modules/firebase-functions

Below is my package.json

"dependencies": {
    "@react-native-community/geolocation": "^2.0.2",
    "@react-native-community/masked-view": "^0.1.11",
    "@react-native-community/push-notification-ios": "^1.10.1",
    "@react-native-firebase/app": "^14.5.1",
    "@react-native-firebase/auth": "^14.5.1",
    "@react-native-firebase/database": "^14.5.1",
    "@react-native-firebase/storage": "^14.5.1",
    "@react-native-google-signin/google-signin": "^7.2.2",
    "@react-native-picker/picker": "^2.3.1",
    "@sentry/react-native": "^3.3.0",
    "firebase-functions": "^3.20.1",
    "flow": "^0.2.3",
    "flow-bin": "^0.173.0",
    "prop-types": "^15.8.1",
    "react": "17.0.2",
    "react-native": "0.67.0",
    "react-native-background-timer": "^2.4.1",
    "react-native-crypto-js": "^1.0.0",
    "react-native-elements": "^3.4.2",
    "react-native-fbsdk": "^3.0.0",
    "react-native-form-validator": "^0.5.1",
    "react-native-fs": "^2.19.0",
    "react-native-gesture-handler": "^2.3.0",
    "react-native-gifted-chat": "^0.16.3",
    "react-native-google-places-autocomplete": "^2.4.1",
    "react-native-image-crop-picker": "^0.37.3",
    "react-native-maps": "^0.30.1",
    "react-native-permissions": "^3.3.0",
    "react-native-phone-number-input": "^2.1.0",
    "react-native-push-notification": "^8.1.1",
    "react-native-reanimated": "^1.13.4",
    "react-native-safe-area-context": "^4.1.2",
    "react-native-screens": "^3.13.1",
    "react-native-sound": "^0.11.2",
    "react-native-switch": "^1.5.1",
    "react-native-vector-icons": "^9.1.0",
    "react-navigation": "^4.4.4",
    "react-navigation-stack": "^2.10.4",
    "react-navigation-tabs": "^2.11.2",
    "react-redux": "^7.2.6",
    "redux": "^4.1.2",
    "redux-thunk": "^2.4.1",
    "symbol-observable": "^4.0.0",
    "twitter-lite": "^1.1.0"
  },


Solution 1:[1]

When handling node packages please ensure the following steps:

  • Remove package-lock.json - if this file originated using a different OS there is a chance that some dependencies are installed with wrong configuration

  • Manually remove node_modules folder - in order to remove current setup (it may include wrong installation of several modules)

  • Reinstall using npm install - this should re-create package-lock.json file as well as relevant deendencies for current OS

My personal tip: add package-lock.json to git.ignore file in order to prevent wrong setup when project moves from one developer (using some OS) to a different developer (which may use a different OS)

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ymz