expo: [SDK32] undefined is not an object (evaluating '_expo2.default.KeepAwake')

Environment

Expo CLI 2.6.14 environment info: System: OS: macOS 10.14.2 Shell: 3.2.57 - /bin/bash Binaries: Node: 8.9.1 - /usr/local/bin/node Yarn: 1.7.0 - /usr/local/bin/yarn npm: 6.5.0 - /usr/local/bin/npm Watchman: 4.9.0 - /usr/local/bin/watchman IDEs: Android Studio: 3.1 AI-173.4819257 Xcode: 10.1/10B61 - /usr/bin/xcodebuild npmPackages: expo: ^32.0.0 => 32.0.0 react: 16.5.0 => 16.5.0 react-native: https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz => 0.57.1 react-navigation: ^3.0.9 => 3.0.9 npmGlobalPackages: expo-cli: 2.6.14

I’m running my app in the Expo client (newly installed) in the iOS Simulator (iPhone 7).

Steps to Reproduce

I followed the upgrade path from SDK31 to SDK32.

Expected Behavior

I should be able to display my app in the Expo client.

Actual Behavior

My app seems to be running (I get logs in my terminal), but the simulator displays a red screen. Dismissing the screen doesn’t show the app. No “extra info”.

undefined is not an object (evaluating '_expo2.default.KeepAwake')
<unknown>
    crna-entry.js:20:17
loadModuleImplementation
    require.js:292:12
guardedLoadModule
    require.js:179:45
global code
    <unknown file>:0

Reproducible Demo

Sorry, I cannot share my project or a reproducible demo at this time.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 13
  • Comments: 21 (4 by maintainers)

Most upvoted comments

Looks like this was related to react-native-scripts for me. I fixed it by following the instructions after running npm start.

Upgrading your project to use Expo CLI: Make these changes to package.json:

  1. Replace ‘react-native-scripts’ with ‘expo’ in the ‘scripts’ config. Example: “scripts”: { “start”: “expo start”, “eject”: “expo eject”, “android”: “expo start --android”, “ios”: “expo start --ios”, “test”: “jest” }
  2. Remove react-native-scripts from devDependencies.

That’s all! Expo CLI will install automatically when you run npm start.

Change the main key to node_modules/expo/AppEntry.js then run npm start -- -c.

I must have been using an old package.json setup 😅

I can confirm removing react-native-scripts and updating main key resolves the issue.

I got this issue, and my package.json doesn’t even have eact-native-scripts

{
  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "eject": "expo eject",
    "test": "node ./node_modules/jest/bin/jest.js --watchAll",
    "lint": "eslint components"
  },
  "jest": {
    "preset": "jest-expo"
  },
  "dependencies": {
    "@expo/samples": "2.1.1",
    "@react-native-community/async-storage": "^1.3.3",
    "expo": "^32.0.0",
    "i18next": "^15.1.0",
    "react": "16.5.0",
    "react-i18next": "^10.9.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-32.0.0.tar.gz",
    "react-native-google-places-autocomplete": "^1.3.9",
    "react-native-maps": "^0.24.2",
    "react-native-table-component": "^1.2.0",
    "react-navigation": "^3.0.9"
  },
  "devDependencies": {
    "babel-eslint": "^10.0.1",
    "babel-preset-expo": "^5.0.0",
    "eslint": "^5.16.0",
    "eslint-plugin-import": "^2.16.0",
    "eslint-plugin-json": "^1.4.0",
    "eslint-plugin-react": "^7.12.4",
    "eslint-plugin-react-native": "^3.6.0",
    "eslint_d": "^7.3.0",
    "jest-expo": "^32.0.0"
  },
  "private": true
}

Screen Shot 2019-05-04 at 4 49 25 PM

In our application we are not importing KeepAwake module.

Same error happen to me, upgrading from expo version 29 to 32.

I think the removal of react-native-scripts was the crucial part because the crna-entry.js was doing var expo = require('expo');.

Hey @SK-DNS-NET and @leovazquezz1, Both SecureStore and Audio are no longer available in expo package. You need to install them by expo install expo-secure-store or expo install expo-av and import them from these packages instead of expo.

to me what solved it was importing the permissions and imagePicker like this:

import * as Permissions from 'expo-permissions'; import * as ImagePicker from 'expo-image-picker';

instead of this:

import Permissions from 'expo-permissions'; import ImagePicker from 'expo-image-picker';

same here

i have done all the above things but still facing the same issue