build:web fails inside npm script with typescript

We are using the expo-cli as a local dependency to run web:build from a npm script without global installation of expo-cli. When executing npm run build:web we get the exception below.

To create a minimal example we created a blank typescript project with expo init and ran npm install -D expo-cli. Doing the same without typescript everything worked as expected, so we think that the problem has something to do with typescript.

expo-diagnostics output

Expo CLI 3.4.1 environment info:
      OS: Linux 4.15 Ubuntu 18.04.3 LTS (Bionic Beaver)
      Shell: 4.4.20 - /bin/bash
      Node: 10.16.2 - ~/.nvm/versions/node/v10.16.2/bin/node
      Yarn: 1.19.1 - /usr/bin/yarn
      npm: 6.9.0 - ~/.nvm/versions/node/v10.16.2/bin/npm
      Android Studio: 3.5 AI-191.8026.42.35.5900203
      @types/react: ^16.8.23 => 16.9.11 
      @types/react-native: ^0.57.65 => 0.57.65 
      expo: ^35.0.0 => 35.0.0 
      react: 16.8.3 => 16.8.3 
      react-native: => 0.59.8

Our execption

>>npm run build:web

> @ build:web /home/anna/examplets
> expo build:web

(node:24316) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'replace' of undefined
    at Object.<anonymous> (/home/anna/examplets/node_modules/@expo/webpack-config/src/withWorkbox.ts:142:10)
    at (<anonymous>)
    at fulfilled (/home/anna/examplets/node_modules/@expo/webpack-config/webpack/withWorkbox.js:4:58)
(node:24316) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:24316) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.


  "main": "node_modules/expo/AppEntry.js",
  "scripts": {
    "start": "expo start",
    "android": "expo start --android",
    "ios": "expo start --ios",
    "web": "expo start --web",
    "eject": "expo eject",
    "build:web": "expo build:web"
  "dependencies": {
    "expo": "^35.0.0",
    "react": "16.8.3",
    "react-dom": "16.8.3",
    "react-native": "",
    "react-native-web": "^0.11.7"
  "devDependencies": {
    "@types/react": "^16.8.23",
    "@types/react-native": "^0.57.65",
    "babel-preset-expo": "^7.1.0",
    "expo-cli": "^3.4.1",
    "typescript": "^3.6.3"
  "private": true
1 Like

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