NetInfo error after upgrading to Expo 39

Please provide the following:

  1. SDK Version: 39
  2. Platforms(Android/iOS/web/all): iOS
  3. Add the appropriate “Tag” based on what Expo library you have a question on.

I’m currently trying to upgrade my RN app to Expo 39. The initial step, which was expo upgrade 39 did not work very smoothly. There was a couple of errors during the upgrade:

✔ Installed expo@^39.0.0
✔ Validated configuration.
✔ No additional changes necessary to app.json config.
✖ Failed to upgrade JavaScript devDependencies: jest-expo@^39.0.0
✖ Failed to upgrade JavaScript dependencies: @expo/vector-icons@^10.0.0 @react-native-community/netinfo@5.9.6 @react-native-community/async-storage@~1.12.0 expo-asset@~8.2.0 expo-camera@~9.0.0 expo-constants@~9.2.0 expo-file-system@~9.2.0 expo-font@~8.3.0 expo-gl@~9.1.1 expo-image-manipulator@~8.3.0 expo-image-picker@~9.1.1 expo-linear-gradient@~8.3.0 expo-mail-composer@~8.4.0 expo-permissions@~9.3.0 expo-secure-store@~9.2.0 react-native-gesture-handler@~1.7.0 react-native-reanimated@~1.13.0 react-native-screens@~2.10.1 react-native-webview@10.7.0 @react-native-community/datetimepicker@3.0.0 react-native@https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz react@16.13.1
✔ Updated known packages to compatible versions.
✔ Removed package-lock.json and deleted node_modules.
✖ Running npm install failed. Please check npm-error.log for more information.
✖ Failed to clear packager cache with error: Can't read JSON file:../app/node_modules/expo/package.json
├─ File:../app/node_modules/expo/package.json
└─ Cause: Error: ENOENT: no such file or directory, open ../app/node_modules/expo/package.json'
✔ Cleared packager cache.

I bumped up the dependencies as recommended here. I cleared watchman cache and node_modules and reinstalled everything watchman watch-del-all && rm -rf node_modules/, but still the same error persit:

Invariant Violation: NetInfo has been removed from React Native. It can now be installed and imported from '@react-native-community/netinfo' instead of 'react-native'. See https://github.com/react-native-community/react-native-netinfo
- node_modules/react-native/Libraries/LogBox/LogBox.js:148:8 in registerError
- node_modules/react-native/Libraries/LogBox/LogBox.js:59:8 in errorImpl
- node_modules/react-native/Libraries/LogBox/LogBox.js:33:4 in console.error
- node_modules/expo/build/environment/react-native-logs.fx.js:27:4 in error
- node_modules/react-native/Libraries/Core/ExceptionsManager.js:104:6 in reportException
- node_modules/react-native/Libraries/Core/ExceptionsManager.js:171:19 in handleException
- node_modules/react-native/Libraries/Core/setUpErrorHandling.js:24:6 in handleError
- node_modules/expo-error-recovery/build/ErrorRecovery.fx.js:9:32 in ErrorUtils.setGlobalHandler$argument_0
- node_modules/regenerator-runtime/runtime.js:63:36 in tryCatch
- node_modules/regenerator-runtime/runtime.js:293:29 in invoke
- node_modules/regenerator-runtime/runtime.js:63:36 in tryCatch
- node_modules/regenerator-runtime/runtime.js:154:27 in invoke
- node_modules/regenerator-runtime/runtime.js:164:18 in PromiseImpl.resolve.then$argument_0
- node_modules/react-native/node_modules/promise/setimmediate/core.js:37:13 in tryCallOne
- node_modules/react-native/node_modules/promise/setimmediate/core.js:123:24 in setImmediate$argument_0
- node_modules/react-native/Libraries/Core/Timers/JSTimers.js:130:14 in _callTimer
- node_modules/react-native/Libraries/Core/Timers/JSTimers.js:181:14 in _callImmediatesPass
- node_modules/react-native/Libraries/Core/Timers/JSTimers.js:441:30 in callImmediates
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:387:6 in __callImmediates
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:135:6 in __guard$argument_0
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:364:10 in __guard
- node_modules/react-native/Libraries/BatchedBridge/MessageQueue.js:134:4 in flushedQueue
* [native code]:null in flushedQueue
* [native code]:null in invokeCallbackAndReturnFlushedQueue

Hey @sahbi, as the error message states, NetInfo was removed from react-native’s core offerings so this is expected and intended behavior. You’ll need to install the community library: NetInfo - Expo Documentation

Cheers,
Adam

Hey @adamjnav , thanks for your response.
NetInfo is already added as 3rd party lib. Here’s my package.json:

{
  "private": true,
  "devDependencies": {
    "babel-eslint": "8.2.6",
    "babel-plugin-inline-dotenv": "1.5.0",
    "babel-plugin-inline-import": "3.0.0",
    "eslint": "4.19.1",
    "eslint-config-airbnb": "16.1.0",
    "eslint-config-prettier": "2.10.0",
    "eslint-config-react-app": "2.1.0",
    "eslint-config-skeleton": "0.1.6",
    "eslint-plugin-import": "2.20.1",
    "eslint-plugin-jsx-a11y": "6.2.3",
    "eslint-plugin-prettier": "2.6.2",
    "eslint-plugin-react": "7.18.3",
    "expo-cli": "^3.28.0",
    "jest": "^25.2.0",
    "jest-expo": "^39.0.0",
    "jest-sonar-reporter": "2.0.0",
    "prettier": "1.19.1",
    "prettier-eslint": "8.8.2",
    "redux-mock-store": "1.5.4",
    "sonarqube-scanner": "2.1.2"
  },
  "main": "./node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "eject": "expo eject",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "lint": "eslint --fix .",
    "unit-test": "jest"
  },
  "jest": {
    "verbose": true,
    "preset": "jest-expo",
    "transform": {
      "^.+\\.js$": "./node_modules/react-native/jest/preprocessor.js"
    },
    "collectCoverage": true,
    "collectCoverageFrom": [
      "reducers/*.{js,jsx}",
      "utils/*.{js,jsx}",
      "!**/node_modules/**"
    ],
    "coverageDirectory": "./reports/coverage/",
    "coverageReporters": [
      "json",
      "lcov",
      "text",
      "clover",
      "html"
    ],
    "coverageThreshold": {
      "global": {
        "branches": 80,
        "functions": 80,
        "lines": 80,
        "statements": -10
      }
    },
    "testResultsProcessor": "jest-sonar-reporter"
  },
  "jestSonar": {
    "reportPath": "reports",
    "reportFile": "test-reporter.xml",
    "indent": 2
  },
  "dependencies": {
    "@expo/browser-polyfill": "0.1.0",
    "@expo/vector-icons": "^10.0.0",
    "@react-native-community/async-storage": "~1.12.0",
    "@react-native-community/datetimepicker": "3.0.0",
    "@react-native-community/netinfo": "^5.9.6",
    "@redux-offline/redux-offline": "^2.6.0-native.0",
    "axios": "0.19.2",
    "babel-cli": "6.26.0",
    "expo": "^39.0.0",
    "expo-asset": "~8.2.0",
    "expo-asset-utils": "1.2.0",
    "expo-camera": "~9.0.0",
    "expo-constants": "~9.2.0",
    "expo-file-system": "~9.2.0",
    "expo-font": "~8.3.0",
    "expo-gl": "~9.1.1",
    "expo-image-manipulator": "~8.3.0",
    "expo-image-picker": "~9.1.1",
    "expo-linear-gradient": "~8.3.0",
    "expo-linking": "^1.0.3",
    "expo-mail-composer": "~8.4.0",
    "expo-permissions": "~9.3.0",
    "expo-pixi": "1.2.0",
    "expo-secure-store": "~9.2.0",
    "expo-svg-uri": "1.1.0",
    "fbjs": "1.0.0",
    "i18next": "11.9.0",
    "jsrsasign": "8.0.19",
    "lodash.debounce": "4.0.8",
    "lodash.deburr": "4.1.0",
    "lodash.get": "4.4.2",
    "moment": "2.24.0",
    "prop-types": "15.7.2",
    "react": "16.13.1",
    "react-i18next": "9.0.2",
    "react-moment-proptypes": "1.7.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-39.0.3.tar.gz",
    "react-native-alert-async": "1.0.5",
    "react-native-gesture-handler": "~1.7.0",
    "react-native-keyboard-aware-scroll-view": "0.9.1",
    "react-native-masked-text": "1.13.0",
    "react-native-modal-datetime-picker": "^8.7.1",
    "react-native-pose": "0.9.1",
    "react-native-reanimated": "~1.13.0",
    "react-native-screens": "~2.10.1",
    "react-native-swiper": "1.6.0",
    "react-native-webview": "10.7.0",
    "react-navigation": "4.2.2",
    "react-navigation-drawer": "1.4.0",
    "react-navigation-stack": "1.7.3",
    "react-redux": "7.2.0",
    "redux": "4.0.5",
    "redux-logger": "3.0.6",
    "redux-thunk": "2.3.0",
    "remove-accents": "0.4.2",
    "sanitize-filename": "1.6.3",
    "styled-components": "5.0.1",
    "uuid": "3.4.0"
  }
}

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