Skip to content
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

Error on reloading page in the initial next.js installation #4456

Closed
RobertB4 opened this issue May 23, 2018 · 15 comments · Fixed by #27306
Closed

Error on reloading page in the initial next.js installation #4456

RobertB4 opened this issue May 23, 2018 · 15 comments · Fixed by #27306

Comments

@RobertB4
Copy link

RobertB4 commented May 23, 2018

Describe the bug
I get the following error shown in the console when I reload a page in firefox:
The connection to http://localhost:3000/_next/webpack-hmr was interrupted while the page was loading.

This seems to happen even with a new next.js installation.

To Reproduce

  • Create a new folder mkdir nextjs-test
  • navigate to the folder and install dependencies npm install --save next react react-dom
  • add the dev script to package.json "dev": "next"
  • create ./pages/index.js and copy the following code:
    export default () => <div>Welcome to next.js!</div>
  • npm run dev and open localhost:3000 in firefox.
  • Reload the browser and open the console. The error should show up in your console.

Expected behavior
I expect no error since I only followed the basic setup.

System information

  • OS: macOS
  • Browser: firefox 60.0.1 (no error when using chrome)
  • Version of Next.js: 6.0.3
@tranvansang
Copy link

I got another error

Error in ./pages/index.js
Module build failed: Error: Plugin/Preset files are not allowed to export objects, only functions. In /home/transang/carstay/test/node_modules/babel-preset-react-app/index.js
at createDescriptor (/home/transang/carstay/test/njs/node_modules/@babel/core/lib/config/config-descriptors.js:179:11)
at /home/transang/carstay/test/njs/node_modules/@babel/core/lib/config/config-descriptors.js:104:12
at Array.map ()
at createDescriptors (/home/transang/carstay/test/njs/node_modules/@babel/core/lib/config/config-descriptors.js:103:27)
at createPresetDescriptors (/home/transang/carstay/test/njs/node_modules/@babel/core/lib/config/config-descriptors.js:95:10)
at /home/transang/carstay/test/njs/node_modules/@babel/core/lib/config/config-descriptors.js:67:19
at presets (/home/transang/carstay/test/njs/node_modules/@babel/core/lib/config/config-descriptors.js:57:25)
at mergeChainOpts (/home/transang/carstay/test/njs/node_modules/@babel/core/lib/config/config-chain.js:298:68)
at /home/transang/carstay/test/njs/node_modules/@babel/core/lib/config/config-chain.js:251:7
at buildRootChain (/home/transang/carstay/test/njs/node_modules/@babel/core/lib/config/config-chain.js:85:20)
at loadPrivatePartialConfig (/home/transang/carstay/test/njs/node_modules/@babel/core/lib/config/partial.js:41:53)
at Object.loadPartialConfig (/home/transang/carstay/test/njs/node_modules/@babel/core/lib/config/partial.js:66:16)
at Object. (/home/transang/carstay/test/njs/node_modules/babel-loader/lib/index.js:82:26)
at Generator.next ()
at step (/home/transang/carstay/test/njs/node_modules/babel-loader/lib/index.js:3:221)
at _next (/home/transang/carstay/test/njs/node_modules/babel-loader/lib/index.js:3:409)

@timneutkens
Copy link
Member

Sounds like you have a babelrc in a directory above the next.js app, next itself doesn’t use babel-preset-react-app, that’s a create-React-app preset

@anshumanv
Copy link

Hey @RobertB4 did you find a workaround?

@timneutkens
Copy link
Member

I'm going to close this as it's probably outdated and fixed already if there was an issue before.

@StephD
Copy link

StephD commented Oct 16, 2019

Hello,

October 2019 here, I still have this error with a lightly different message :
The connection to http://localhost:3000/_next/webpack-hmr?page=/ was interrupted while the page was loading.

Anyway to clean a bit the console in dev mod?

Thanks

@jleei
Copy link

jleei commented Oct 17, 2019

Hello,

October 2019 here, I still have this error with a lightly different message :
The connection to http://localhost:3000/_next/webpack-hmr?page=/ was interrupted while the page was loading.

Anyway to clean a bit the console in dev mod?

Thanks

Bump, same problem here. Next 9.1.1

@Nicolas-Menettrier
Copy link

Same, only with firefox.

@fveauvy
Copy link

fveauvy commented Nov 19, 2019

Same problem, only with Firefox too

@adam-beck
Copy link

@timneutkens can this issue be reopened? Or should we create a new one, separate for Firefox issues?

@wesbos
Copy link
Contributor

wesbos commented Dec 18, 2019

Getting this on firefox too. Good news is that soon firefox will be able to negate things from the filter with "-webpack" - but not yet :(

@wesbos
Copy link
Contributor

wesbos commented Dec 18, 2019

I've created a new issue for this:

#9776

@bfunc
Copy link

bfunc commented Mar 1, 2021

having similar error
GET http://localhost:3000/_next/webpack-hmr?page=/
(canceled) | eventsource

hot reload do not works (no updating triangle)

issue happens from version 10.0.5 and greater, versions from 10.0.0 to 10.0.4 are working ok, I was able to downgrade and work normally

it is strange but looks like it is only browsers (tested Chrome and Firefox on two diffrent machines) cannot perfom request, commands like wget or curl do receive data

@edikabe
Copy link

edikabe commented Mar 7, 2021

having similar error
GET http://localhost:3000/_next/webpack-hmr?page=/
(canceled) | eventsource

hot reload do not works (no updating triangle)

issue happens from version 10.0.5 and greater, versions from 10.0.0 to 10.0.4 are working ok, I was able to downgrade and work normally

it is strange but looks like it is only browsers (tested Chrome and Firefox on two diffrent machines) cannot perfom request, commands like wget or curl do receive data

Hey bfunc I had similar issue and removing an old registered service-worker solved my problem, please take a look --> #9776 (comment)

@ShahriarKh
Copy link
Contributor

I resolved this by removing the assetPrefix from the config file.

//next.config.js

module.exports = withOptimizedImages({
   assetPrefix: ".", //remove this when in development mode
});

kodiakhq bot pushed a commit that referenced this issue Jul 19, 2021
This fixes a case where the HMR connection for fast refresh would fail to connect on Windows due to a change being made to the default host being listened to. Previously we didn't set a default for the `host` value when calling `server.listen` which allowed the default listening behavior to be used although in #20409 a default of `0.0.0.0` was added which causes conflicts for some set-ups mainlly on Windows it seems. 

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added (N/A)
- [x] Errors have helpful link attached, see `contributing.md`

Fixes: #27298
Fixes: #27254
Fixes: #4456 (comment)
Fixes: #20409 (comment)
x-ref: #20409
flybayer pushed a commit to blitz-js/next.js that referenced this issue Aug 19, 2021
This fixes a case where the HMR connection for fast refresh would fail to connect on Windows due to a change being made to the default host being listened to. Previously we didn't set a default for the `host` value when calling `server.listen` which allowed the default listening behavior to be used although in vercel#20409 a default of `0.0.0.0` was added which causes conflicts for some set-ups mainlly on Windows it seems. 

## Bug

- [x] Related issues linked using `fixes #number`
- [ ] Integration tests added (N/A)
- [x] Errors have helpful link attached, see `contributing.md`

Fixes: vercel#27298
Fixes: vercel#27254
Fixes: vercel#4456 (comment)
Fixes: vercel#20409 (comment)
x-ref: vercel#20409
@balazsorban44
Copy link
Member

This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.