expo-cli: TypeError: Cannot read property 'compile' of undefined
Description
Expo-cli is crashing on npm start with the error message
[02:46:59] TypeError: Cannot read property 'compile' of undefined
Expected Behavior
- install expo-cli using
npm install expo-cli -g - start a new project using 'expo init`
- Browser pops up with dev tools and a QR code is visible on the terminal.
Observed Behavior
- The browser opens up blank
- The terminal reads:
msalar@Dranzer:~$ expo init myproj
? Choose a template: blank
[02:57:27] Extracting project files...
[02:57:28] Customizing project...
Your project is ready at /home/msalar/myproj
To get started, you can type:
cd myproj
expo start
msalar@Dranzer:~$ cd myproj/
msalar@Dranzer:~/myproj$ npm start
> empty-project-template@ start /home/msalar/myproj
> expo start
[03:01:33] Starting project at /home/msalar/myproj
[03:01:33] Expo DevTools is running at http://localhost:19002
[03:01:33] Opening DevTools in the browser... (press shift-d to disable)
[03:01:37] TypeError: Cannot read property 'compile' of undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! empty-project-template@ start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the empty-project-template@ start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/msalar/.npm/_logs/2018-11-25T22_01_37_331Z-debug.log
msalar@Dranzer:~/myproj$
Here's the log file
0 info it worked if it ends with ok
1 verbose cli [ '/home/msalar/.nvm/versions/node/v8.12.0/bin/node',
1 verbose cli '/home/msalar/.nvm/versions/node/v8.12.0/bin/npm',
1 verbose cli 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle empty-project-template@~prestart: empty-project-template@
6 info lifecycle empty-project-template@~start: empty-project-template@
7 verbose lifecycle empty-project-template@~start: unsafe-perm in lifecycle true
8 verbose lifecycle empty-project-template@~start: PATH: /home/msalar/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/msalar/myproj/node_modules/.bin:/home/msalar/.nvm/versions/node/v8.12.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
9 verbose lifecycle empty-project-template@~start: CWD: /home/msalar/myproj
10 silly lifecycle empty-project-template@~start: Args: [ '-c', 'expo start' ]
11 silly lifecycle empty-project-template@~start: Returned: code: 1 signal: null
12 info lifecycle empty-project-template@~start: Failed to exec start script
13 verbose stack Error: empty-project-template@ start: `expo start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/home/msalar/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (/home/msalar/.nvm/versions/node/v8.12.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:915:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid empty-project-template@
15 verbose cwd /home/msalar/myproj
16 verbose Linux 4.15.0-29-generic
17 verbose argv "/home/msalar/.nvm/versions/node/v8.12.0/bin/node" "/home/msalar/.nvm/versions/node/v8.12.0/bin/npm" "start"
18 verbose node v8.12.0
19 verbose npm v6.4.1
20 error code ELIFECYCLE
21 error errno 1
22 error empty-project-template@ start: `expo start`
22 error Exit status 1
23 error Failed at the empty-project-template@ start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Environment
It was giving errors so I set EXPO_DEBUG=true.
msalar@Dranzer:~/myproj$ expo diagnostics
[03:03:48] Generating diagnostics report...
[03:03:48] You can join our slack here: https://slack.expo.io/.
Expo CLI 2.4.0 environment info:
System:
OS: Linux 4.15 Ubuntu 18.04.1 LTS (Bionic Beaver)
Shell: 4.4.19 - /bin/bash
Binaries:
Node: 8.12.0 - ~/.nvm/versions/node/v8.12.0/bin/node
npm: 6.4.1 - ~/.nvm/versions/node/v8.12.0/bin/npm
npmPackages:
expo: ^31.0.2 => 31.0.2
react: 16.5.0 => 16.5.0
react-native: https://github.com/expo/react-native/archive/sdk-31.0.0.tar.gz => 0.57.1
npmGlobalPackages:
expo-cli: 2.4.0
Diagnostics report:
/[03:03:50] Request failed with status code 500
[03:03:50] Error: Request failed with status code 500
at createError (/home/msalar/.nvm/versions/node/v8.12.0/lib/node_modules/expo-cli/node_modules/axios/lib/core/createError.js:16:15)
at settle (/home/msalar/.nvm/versions/node/v8.12.0/lib/node_modules/expo-cli/node_modules/axios/lib/core/settle.js:17:12)
at IncomingMessage.handleStreamEnd (/home/msalar/.nvm/versions/node/v8.12.0/lib/node_modules/expo-cli/node_modules/axios/lib/adapters/http.js:236:11)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9)
Reproducible Demo
- install expo-cli using
npm install expo-cli -g - start a new project using 'expo init`
- cd into the project folder and run
expo startornpm start
running publish locally repeatedly i'm hitting no issues at all.
expo diagnostics from my local machine:
Expo CLI 2.4.0 environment info:
System:
OS: macOS High Sierra 10.13.5
Shell: 5.6.2 - /usr/local/bin/zsh
Binaries:
Node: 11.0.0 - ~/.nvm/versions/node/v11.0.0/bin/node
Yarn: 1.12.1 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v11.0.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
IDEs:
Android Studio: 3.1 AI-173.4720617
Xcode: /undefined - /usr/bin/xcodebuild
npmPackages:
expo: 31.0.5 => 31.0.5
react: 16.6.0-alpha.8af6728 => 16.6.0-alpha.8af6728
react-native: https://github.com/expo/react-native/archive/sdk-31.0.1.tar.gz => 0.57.1
react-navigation: 3.0.0 => 3.0.0
Diagnostics report:
https://exp-xde-diagnostics.s3.amazonaws.com/lithodomos-eb5107c5-3a70-40fe-b4fe-3e7bc77eec92.tar.gz
looking at the original post, it looks like it threw an error even trying to upload diagnostic reports.
we just hit the same error on 2 deployments jobs in our CI environment, and are running a 3rd time now w/ EXPO_DEBUG enabled - but is this a bug pushed to expo's infrastructure or something? ephemeral routing issue?
Is there any temporary fix for this problem? I need to demo my final project for class tmr. Help!!!
@KaizhaoLiang I've been able to replicate it on Node 8, but on the latest (Node 11) it just works. Might be something for you to try for your demo...
@KaizhaoLiang I've been able to replicate it on Node 8, but on the latest (Node 11) it just works. Might be something for you to try for your demo...
I'm on v11.1.0 and still having this issue.
I've tried v8.11.3 and v11.2.0, having the same issue.
@KaizhaoLiang I've been able to replicate it on Node 8, but on the latest (Node 11) it just works. Might be something for you to try for your demo...
running 11.0 locally works, but 11.0 is failing in our CI
I'm seeing this issue locally on my Macbook Pro with Node versions 8.9.4, 11.0.0, and 11.2.0. I have not attempted on any other platforms.
I was setting up expo on my new laptop and I got the same error on a new project with node v11.2.0. Here is the diagnostics report
Sujiths-MBP:personal sujithvellat$ expo init ? Choose a project name: MyApp ? Choose a template: blank [17:47:48] Downloading project files... [17:47:52] Extracting project files... [17:47:58] Customizing project...
Your project is ready at /Users/sujithvellat/projects/personal/MyApp To get started, you can type:
cd MyApp expo start
Sujiths-MBP:personal sujithvellat$ cd MyApp/ Sujiths-MBP:MyApp sujithvellat$ expo start [17:48:13] Starting project at /Users/sujithvellat/projects/personal/MyApp [17:48:14] Expo DevTools is running at http://localhost:19004 [17:48:14] Opening DevTools in the browser... (press shift-d to disable) [17:48:15] TypeError: Cannot read property 'compile' of undefined Sujiths-MBP:MyApp sujithvellat$ expo diagnostics [17:48:43] Generating diagnostics report... [17:48:43] You can join our slack here: https://slack.expo.io/.
Expo CLI 2.4.0 environment info: System: OS: macOS 10.14.1 Shell: 3.2.57 - /bin/bash Binaries: Node: 11.2.0 - /usr/local/bin/node npm: 6.4.1 - /usr/local/bin/npm IDEs: Xcode: 10.1/10B61 - /usr/bin/xcodebuild npmPackages: expo: ^31.0.2 => 31.0.2 react: 16.5.0 => 16.5.0 react-native: https://github.com/expo/react-native/archive/sdk-31.0.0.tar.gz => 0.57.1
Diagnostics report: https://exp-xde-diagnostics.s3.amazonaws.com/marlabsinnovations-899a40d7-9f17-4512-8901-468fecc390b0.tar.gz
I've opened a forum issue, sometimes they respond faster there. https://forums.expo.io/t/new-project-with-expo-cli-crashes/16310.
I can replicate it with both Node 11, and Node 8, even after refreshing my node modules.
I'm facing the same issues when creating a new app with expo on 8 and also on 11
I am also facing the same issue.
[02:18:25] Expo DevTools is running at http://localhost:19002
[02:18:25] Opening DevTools in the browser... (press shift-d to disable)
[02:18:30] TypeError: Cannot read property 'compile' of undefined
Also facing this and it's driving me nuts - worked perfectly until yesterday.
I also tried installing webpack-dev-server for what it's worth (saw some older issues related to this) but didn't do anything.
Can repro, Node 10.13.0
Ran with DEBUG=true option, got the following output. https://gist.github.com/SunburntRock89/250012020cd0cfbd273113688c28b0db
Tried to get diagnostic info but got
D:\Documents\Projects\YT-App>expo diagnostics
[23:42:33] Generating diagnostics report...
[23:42:33] You can join our slack here: https://slack.expo.io/.
Expo CLI 2.4.0 environment info:
System:
OS: Windows 10
Binaries:
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
Diagnostics report:
\[23:42:37] Request failed with status code 500
[23:42:37] Error: Request failed with status code 500
at createError (C:\Users\rhys0\AppData\Roaming\npm\node_modules\expo-cli\node_modules\axios\lib\core\createError.js:16:15)
at settle (C:\Users\rhys0\AppData\Roaming\npm\node_modules\expo-cli\node_modules\axios\lib\core\settle.js:17:12)
at IncomingMessage.handleStreamEnd (C:\Users\rhys0\AppData\Roaming\npm\node_modules\expo-cli\node_modules\axios\lib\adapters\http.js:236:11)
at IncomingMessage.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1094:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
I tried [email protected] on node 10.11, same problem.
Same error - expo-cli 2.1.0 and 2.4.0 on both node 10.4.0 and 11.2.0
Same here. expo-cli 2.3.8 and 2.4.0 on node 8.11.3 on Mac
+1
node v10.5.0 and expo 2.4.0 on Macbook Pro
+1 I tried expo-cli 2.2.0, 2.2.4, 2.3.0 and 2.4.0 and node v8.12.0 on Ubuntu 18.04