Skip to content

Commit

Permalink
fix(metro): cannot read property 'toUpperCase' of undefined (#687)
Browse files Browse the repository at this point in the history
Summary:
**Summary**

Latest Metro crashes in React Native 0.65.0-rc.2:

```
/~/node_modules/metro-hermes-compiler/src/emhermesc.js:77
          throw ex;
          ^

RuntimeError: abort(TypeError: Cannot read property 'toUpperCase' of undefined). Build with -s ASSERTIONS=1 for more info.
    at process.abort (/~/node_modules/metro-hermes-compiler/src/emhermesc.js:440:13)
    at process.emit (node:events:406:35)
    at emit (node:internal/process/promises:136:22)
    at processPromiseRejections (node:internal/process/promises:242:25)
    at processTicksAndRejections (node:internal/process/task_queues:97:32)
Process terminated. Press <enter> to close the window
```

**Test plan**

```
npx react-native init RN065RC2 --version 0.65.0-rc.2
cd RN065RC2
yarn ios
```

Pull Request resolved: #687

Reviewed By: RSNara

Differential Revision: D29736692

Pulled By: ShikaSD

fbshipit-source-id: cbd391c16951dd30b6fb31beaedf8f0ac6ee25f9
  • Loading branch information
tido64 authored and facebook-github-bot committed Jul 17, 2021
1 parent 48b5b1e commit f7c6325
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/metro/src/lib/logToConsole.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ module.exports = (
data[data.length - 1] = lastItem.trimEnd();
}

const modePrefix = mode == 'BRIDGE' ? '' : `(${mode.toUpperCase()}) `;
const modePrefix =
!mode || mode == 'BRIDGE' ? '' : `(${mode.toUpperCase()}) `;
terminal.log(
color.bold(` ${modePrefix}${logFunction.toUpperCase()} `) +
''.padEnd(groupStack.length * 2, ' '),
Expand Down

0 comments on commit f7c6325

Please sign in to comment.