Skip to content

Cannot read property 'replace' of null #134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
axpro opened this issue Jul 23, 2016 · 12 comments
Closed

Cannot read property 'replace' of null #134

axpro opened this issue Jul 23, 2016 · 12 comments

Comments

@axpro
Copy link

axpro commented Jul 23, 2016

Uncaught TypeError: Cannot read property 'replace' of null in webpack:///(webpack)-dev-server/client?:5 on chrome/mac

It's working if I change webpack-dev-server to 1.14.0 in react-scripts.

webpack/webpack-dev-server#381

@gaearon
Copy link
Contributor

gaearon commented Jul 23, 2016

Does it happen with the initially created project, or did you change something in it? Can you show your changes reproducing the problem?

@axpro
Copy link
Author

axpro commented Jul 23, 2016

I didn't change anything. I created a new app just to test this, I didn't even open it in my editor.
I specified the browser because it seems to work in safari and firefox. In chrome I tried incognito with no extensions and it still doesn't work.

@gaearon
Copy link
Contributor

gaearon commented Jul 23, 2016

Can you please also specify exact versions of OS and Chrome? Thanks.

@axpro
Copy link
Author

axpro commented Jul 23, 2016

OSX El Capitan 10.11.5
Chrome was 51.0.2704.103, I updated to 52.0.2743.82 and it shows the same error.

@axpro
Copy link
Author

axpro commented Jul 23, 2016

The exact line is:
var scriptHost = scriptElements[scriptElements.length-1].getAttribute("src").replace(/\/[^\/]+$/, "");
under a comment that says:
/* WEBPACK VAR INJECTION */

@axpro
Copy link
Author

axpro commented Jul 23, 2016

I found the problem. Somehow when I tested in incognito I didn't notice that an extension (poper blocker), which causes the problem, was allowed. Sorry for wasting your time.

@axpro axpro closed this as completed Jul 23, 2016
@vjeux
Copy link
Contributor

vjeux commented Jul 23, 2016

Can you tell which extension / version it was. Someone may have the same problem in the future and maybe we can fix the extension

@axpro
Copy link
Author

axpro commented Jul 23, 2016

It was this extension:
https://chrome.google.com/webstore/detail/poper-blocker/bkkbcggnhapdmkeljlodobbkopceiche?hl=en

I tried to use another extension (https://chrome.google.com/webstore/detail/popup-blocker-pro/kiodaajmphnkcajieajajinghpejdjai?hl=en) and the same error occurred.

I think the problem would be better resolved in webpack-dev-server with a better selector than scriptElements[scriptElements.length-1] as I think there are many extensions which inject scripts into the page.

@gaearon
Copy link
Contributor

gaearon commented Jul 23, 2016

Let’s keep it open until we solve it either with a patch to WDS or a mention in the docs.

@gaearon gaearon reopened this Jul 23, 2016
@axpro axpro changed the title great start: Cannot read property 'replace' of null Cannot read property 'replace' of null Jul 23, 2016
@gaearon
Copy link
Contributor

gaearon commented Sep 3, 2016

webpack/webpack-dev-server#496 was merged, we should update WDS after a patch.

@gaearon
Copy link
Contributor

gaearon commented Sep 24, 2016

I think this was fixed in WDS 1.x branch with webpack/webpack-dev-server#496 and we have this fix. Closing.

@gaearon gaearon closed this as completed Sep 24, 2016
@gaearon
Copy link
Contributor

gaearon commented Sep 24, 2016

Oops, relevant 1.x commit is webpack/webpack-dev-server@7c46b74.

@lock lock bot locked and limited conversation to collaborators Jan 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants