create-react-app-typescript icon indicating copy to clipboard operation
create-react-app-typescript copied to clipboard

Uncaught TypeError: Cannot read property 'replace' of null

Open zheeeng opened this issue 7 years ago • 7 comments

Is this a bug report?

Yes

Can you also reproduce the problem with npm 4.x?

Yes

Which terms did you search for in User Guide?

Uncaught TypeError: Cannot read property 'replace' of null

Environment

I tried 3 versions of node and npm, all produce this problem.

npm -v: 6.2.0 node -v: v10.9.0 yarn -v: 1.9.4

npm -v: 5.6.0 node -v: v8.5.0

npm -v: 4.1.2 node -v: v7.5.0

create-react-app -V: 1.5.2 react-scripts-ts: 2.17.0

Steps to Reproduce

  1. yarn global add create-react-app
  2. create-react-app xxx --scripts-version=react-scripts-ts
  3. cd xxx && yarn start

Expected Behavior

yarn start

everything works fine

Actual Behavior

yarn start

browser console report:

Uncaught TypeError: Cannot read property 'replace' of null
    at getDataFiber (backend.js:9885)
    at enqueueMount (backend.js:9572)
    at mountFiber (backend.js:9640)
    at backend.js:9700
    at Set.forEach (<anonymous>)
    at Object.walkTree (backend.js:9698)
    at backend.js:8339
    at <anonymous>:52:32
    at Array.map (<anonymous>)
    at Object.emit (<anonymous>:51:66)
    at setupBackend (backend.js:8414)
    at module.exports (backend.js:8360)
    at Agent.<anonymous> (backend.js:114)
    at Agent.g (backend.js:933)
    at Agent.EventEmitter.emit (backend.js:846)
    at backend.js:298
    at backend.js:7426
    at Array.forEach (<anonymous>)
    at backend.js:7425
    at Array.forEach (<anonymous>)
    at Bridge._handleMessage (backend.js:7418)
    at listener (backend.js:90)

Reproducible Demo

(Paste the link to an example project and exact instructions to reproduce the issue.)

zheeeng avatar Sep 10 '18 01:09 zheeeng

I got the same error on console, But the app works fine . I use React.Fragment to replace some empty div,then errro occurred

peterlxb avatar Sep 17 '18 06:09 peterlxb

I encountered this same problem. I fix this problem by downgrade react version from 16.5.2 to 16.2.1

happier2 avatar Sep 25 '18 15:09 happier2

I was having this problem too. Upgrading to react 16.6.0 resolved it for me.

oglej avatar Oct 24 '18 13:10 oglej

Upgrading react-dom from 16.5.2 to 16.6.0 caused this error for me.

batamire avatar Oct 25 '18 13:10 batamire

Exact same as betamire. Upgrading from 16.5.2 to 16.6.0.

DeadIine avatar Oct 28 '18 20:10 DeadIine

As @batamire and @deadline98 have suggested, I got this error after upgrading react and react-dom to 16.6.0. I fixed this error by updating React DevTools, I had been running 3.4.1 and updated to 3.4.2. I just removed it and reinstalled it and the error went away and RDT worked correctly again. I'll note that my app was not created using create-react-app-typescript so your mileage may vary.

graywithanA avatar Oct 30 '18 21:10 graywithanA

The error stack listed in the report refers to a function in the react-devtools browser extension, getDataFiber: https://github.com/facebook/react-devtools/blob/3e1fba8efe26f6e4c955382d28401046fe1ae83e/backend/attachRendererFiber.js#L168

So this error does not seem to be related to CRA or CRA-TS in particular, it's just an outdated browser extension...

DorianGrey avatar Oct 31 '18 07:10 DorianGrey