gatsby: npm run develop results in address already in use 127.0.0.1:xxxx
This happens with the starter as well as customized apps.
Checking via netstat -a on Windows the ports in question all seem to be open and available, and although I am using the standard dev port 8000, I get the following error:
⠋ gatsby-source-wordpress pull updates since last build
Error: listen EADDRINUSE: address already in use 127.0.0.1:63955
at Server.setupListenHandle [as _listen2] (net.js:1318:16)
at listenInCluster (net.js:1366:12)
at GetAddrInfoReqWrap.doListen (net.js:1503:7)
at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:69:8)
Emitted 'error' event on Server instance at:
at emitErrorNT (net.js:1345:8)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
code: 'EADDRINUSE',
errno: -4091,
syscall: 'listen',
address: '127.0.0.1',
port: 63955
}
This happens with any other manually entered port as well. A fresh install may work for a bit but eventually fails as well. I have predominantly noticed this after changing Wordpress data and restarting the process, but can’t confirm that it only happens after changing data.
I am using a docker setup, but the problem persists when using Local by Flywheel
version: "3.8"
services:
db:
image: mariadb:10.5.8
restart: always
volumes:
- db-data:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: root
MYSQL_DATABASE: wordpress
MYSQL_USER: wordpress
MYSQL_PASSWORD: wordpress
ports:
- 3306:3306
wordpress:
depends_on:
- db
image: wordpress:latest
ports:
- "3000:80"
restart: always
environment:
WORDPRESS_DB_HOST: db:3306
WORDPRESS_DB_USER: wordpress
WORDPRESS_DB_PASSWORD: wordpress
WORDPRESS_DB_NAME: wordpress
volumes:
- wordpress:/var/www/html
adminer:
image: adminer
restart: always
ports:
- 8080:8080
volumes:
db-data:
wordpress:
Gatsby config:
plugins: [
{
resolve: "gatsby-source-wordpress-experimental",
options: {
url: "http://localhost:3000/graphql",
},
// removed the other plugins for brevity
],
And versions (again edited for brevity):
"dependencies": {
"gatsby": "^2.31.1",
"gatsby-source-wordpress-experimental": "^7.0.3",
"react": "^17.0.1",
"react-dom": "^17.0.1",
},
I don’t know where the process gets this port from 127.0.0.1:63955, since I either don’t specify it or stick to something shorter (e.g. -p 4000). I’ve also noticed that once the develop script is done and the dev url is shown, the process starts over as if it has trouble persisting the changes.
If I am forgetting anything please let me know and I will edit the post promptly. I have found similar posts but they always showed that the specified port was in use.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 28 (9 by maintainers)
Hi there, it looks like several users are impacted by this bug, we’re prioritizing it and hope to have a fix in the next month. Completely unrelated, but in the meantime we’re working on a significant rewrite of CMS Preview 🎉
@TylerBarnes This worked for me!! Thank you so much. This was causing quite the headache!
Confirming that setting
process.env.WP_DISABLE_POLLING=1is a valid work around.gatsby infooutput:I published another canary version that’s exactly the same as the one above but with the debugging console.log’s removed
gatsby-source-wordpress@5.7.0-alpha-wordpress.8+e70deff92e.@franciscocobas definitely not a silly question 😃 You can install it like
yarn add gatsby-source-wordpress@5.7.0-alpha-wordpress.0+fe81b6e978ornpm install gatsby-source-wordpress@5.7.0-alpha-wordpress.0+fe81b6e978@TylerBarnes This worked for me too. Thank you so much .
@TylerBarnes
System: OS: Linux 5.8 Ubuntu 20.04.2 LTS (Focal Fossa) CPU: (8) x64 Intel® Core™ i5-10210U CPU @ 1.60GHz Shell: 5.0.17 - /bin/bash Binaries: Node: 14.17.0 - /usr/bin/node Yarn: 1.22.5 - /usr/bin/yarn npm: 6.14.13 - /usr/bin/npm Browsers: Chrome: 91.0.4472.77 Firefox: 88.0.1 npmPackages: gatsby: ^3.1.2 => 3.6.1 gatsby-background-image: ^1.5.0 => 1.5.3 gatsby-plugin-emotion: ^6.1.0 => 6.6.0 gatsby-plugin-image: ^1.1.2 => 1.6.0 gatsby-plugin-preact: ^5.5.0 => 5.6.0 gatsby-plugin-react-helmet: ^4.1.0 => 4.6.0 gatsby-plugin-s3: ^0.3.8 => 0.3.8 gatsby-plugin-sharp: ^3.1.2 => 3.6.0 gatsby-source-filesystem: ^3.1.0 => 3.6.0 gatsby-source-graphql: ^3.1.0 => 3.6.0 gatsby-source-wordpress: ^5.6.0 => 5.6.0 gatsby-transformer-sharp: ^3.1.0 => 3.6.0 npmGlobalPackages: gatsby-cli: 3.6.0
Awesome! 👏🏻
btw you can get around this problem by setting
process.env.WP_DISABLE_POLLING=1as that var disables the part of the codebase that’s triggering this issue.