Skip to content

[0.18-rc][packager] Packager throws error "Cannot read property 'error' of null" instead of babel errors #5191

Closed
@corbt

Description

@corbt

This is to track the error first reported in #5188 and #5190. (The thread in #5188 got long because we weren't sure if it was related to the simultaneous but unrelated babel classProperties syntax change, so I'm consolidating here.)

There's a regression in the packager in 0.18-rc where babel syntax errors aren't passed through to the user, making it difficult to fix the underlying bugs. These are the error messages for the same bug running react-native bundle:

React Native 0.17

uncaught error Error: SyntaxError: /Users/kyle/proj/chimera/app/actions/auth.js: 'import' and 'export' may only appear at the top level (22:0)
  20 |
  21 |
> 22 | export function logOut() {
     | ^
  23 |   return {type: LOG_OUT};
  24 | }

React Native 0.18-rc

uncaught error Error: TypeError: Cannot read property 'error' of null
    at index.js:117:20
    at tryCallOne (/Users/kyle/proj/chimera/node_modules/react-native/node_modules/promise/lib/core.js:37:12)
    at /Users/kyle/proj/chimera/node_modules/react-native/node_modules/promise/lib/core.js:123:15
    at flush (/Users/kyle/proj/chimera/node_modules/react-native/node_modules/promise/node_modules/asap/raw.js:50:29)
    at doNTCallback0 (node.js:428:9)
TransformError: /Users/kyle/proj/chimera/app/actions/auth.js: Cannot read property 'error' of null
See logs /var/folders/j4/wct0sgyx0p9803_1nkhm3pzm0000gn/T/react-packager.log
    at SocketClient._handleMessage (SocketClient.js:139:23)
    at BunserBuf.<anonymous> (SocketClient.js:53:42)
    at emitOne (events.js:77:13)
    at BunserBuf.emit (events.js:169:7)
    at BunserBuf.process (/Users/kyle/proj/chimera/node_modules/react-native/node_modules/bser/index.js:289:10)
    at /Users/kyle/proj/chimera/node_modules/react-native/node_modules/bser/index.js:244:12
    at doNTCallback0 (node.js:428:9)
    at process._tickCallback (node.js:357:13)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions