After upgrade to 10.11.1 netlify dev hangs on "waiting for port"
Describe the bug
Upgraded to latest 10.11.1, running netlify dev
It just keeps hanging on "waiting for port forever"
⠋ Waiting for framework port 8080. This can be configured using the 'targetPort' property in the netlify.toml
No matter if I add the targetPort to netlify.toml or not, or also whhich port (tried 8080, 8888, 8081 etc)
valhalla-landers on main [?] via v18.6.0 on ☁️ took 45s
❯ netlify dev
(node:3821) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
wasm streaming compile failed: TypeError: Failed to parse URL from /usr/local/lib/node_modules/netlify-cli/node_modules/netlify-redirector/lib/redirects.wasm
falling back to ArrayBuffer instantiation
◈ Netlify Dev ◈
◈ Ignored general context env var: LANG (defined in process)
◈ Ignored general context env var: LC_ALL (defined in process)
◈ Injected .env file env var: ELEVENTY_ENV
◈ Injected .env file env var: SITE_ID
◈ Injected .env file env var: BROWSER
◈ Injected .env file env var: WCT_API_KEY
◈ Injected .env file env var: UPSTASH_REDIS_REST_URL
◈ Injected .env file env var: UPSTASH_REDIS_REST_TOKEN
◈ Injected .env file env var: UPSTASH_CLOAKING_REDIS_REST_URL
◈ Injected .env file env var: UPSTASH_CLOAKING_REDIS_REST_TOKEN
◈ Injected .env file env var: IPDATA_API_KEY
◈ Loaded function create-redirects.
◈ Loaded function delete-redirects.
◈ Loaded function landers.
◈ Loaded function offers.
◈ Loaded function query.
◈ Functions server is listening on 53716
◈ Starting Netlify Dev with Eleventy
> [email protected] dev
> run-p clean sass webpack:dev 11ty:dev
> [email protected] clean
> rimraf dist/*
> [email protected] sass
> sass resources/scss/main.scss dist/assets/css/main.css
> [email protected] webpack:dev
> webpack --mode development --watch
> [email protected] 11ty:dev
> ELEVENTY_ENV=development npx @11ty/eleventy
1 asset
236 modules
webpack 5.69.1 compiled successfully in 1460 ms
[11ty] Writing dist/robots.txt from ./site/robots.njk
[11ty] Writing dist/9ffe3f93-8774-4e12-a1bf-540baec15ebb/index.html from ./site/index.njk
[11ty] Writing dist/70ffc2c1-feb1-47ea-ac72-63b2411ee09c/index.html from ./site/index.njk
[11ty] Writing dist/63e88395-9247-4b88-92c9-1ef649944149/index.html from ./site/index.njk
[11ty] Writing dist/pages/terms-of-use/index.html from ./site/pages/terms-of-use.md (njk)
[11ty] Writing dist/pages/contact/index.html from ./site/pages/contact.md (njk)
[11ty] Writing dist/pages/privacy-policy/index.html from ./site/pages/privacy-policy.md (njk)
[11ty] Writing dist/pages/legal-disclosure/index.html from ./site/pages/legal-disclosure.md (njk)
[11ty] Writing dist/404.html from ./site/404.md (njk)
[11ty] Writing dist/pages/about/index.html from ./site/pages/about.md (njk)
[11ty] Benchmark 798ms 54% 1× (Data) `./site/_data/valhalla.js`
[11ty] Copied 5 files / Wrote 10 files in 1.02 seconds (102.0ms each, v1.0.0)
⠙ Waiting for framework port 8080. This can be configured using the 'targetPort' property in the netlify.toml
My package.json scripts & deps:
"scripts": {
"help": "npx @11ty/eleventy --help",
"clean": "rimraf dist/*",
"sass": "sass resources/scss/main.scss dist/assets/css/main.css",
"webpack:dev": "webpack --mode development --watch",
"webpack:prod": "webpack --mode production",
"11ty:dev": "ELEVENTY_ENV=development npx @11ty/eleventy --serve --watch",
"11ty:prod": "ELEVENTY_ENV=production npx @11ty/eleventy",
"dev": "run-p clean sass webpack:dev 11ty:dev",
"prod": "run-s sass 11ty:prod webpack:prod"
},
"dependencies": {
"@babel/runtime": "^7.17.2",
"@upstash/redis": "^1.0.3",
"alpinejs": "^3.9.1",
"axios": "^0.27.2",
"base64-url": "^2.3.3",
"ipdata": "^1.1.2",
"unfetch": "^4.2.0"
},
"devDependencies": {
"@11ty/eleventy": "^1.0.0",
"@11ty/eleventy-navigation": "^0.3.2",
"@babel/plugin-transform-runtime": "^7.17.0",
"@babel/preset-env": "^7.16.11",
"@babel/runtime-corejs3": "^7.17.2",
"babel-loader": "^8.2.3",
"clean-css": "^5.2.4",
"gorko": "^0.4.1",
"html-minifier": "^4.0.0",
"netlify-cli": "^10.11.1",
"node-html-parser": "^4.1.0",
"npm-run-all": "^4.1.5",
"postcss": "^8.3.5",
"purgecss": "^4.1.3",
"resolve-url-loader": "^4.0.0",
"rimraf": "^2.7.1",
"sass": "^1.49.9",
"webpack": "^5.69.1",
"webpack-cli": "^4.9.2"
}
Steps to reproduce
Upgrade to latest version, use netlify.toml and package.json i posted here (I assume)
Configuration
[build]
build = "/"
command = "npm run prod"
publish = "dist"
[dev]
command = "npm run dev"
framework = "eleventy"
publish = "dist"
[[headers]]
# Define which paths this specific [[headers]] block will cover.
for = "/*"
[headers.values]
Referrer-Policy = "no-referrer"
X-Frame-Options = "DENY"
X-Robots-Tag = "noindex"
X-XSS-Protection = "1; mode=block"
[functions]
# Directory with serverless functions, including background functions,
# to deploy. This is relative to the base directory if one has been set,
# or the root directory if a base hasn’t been set.
directory = ".netlify/functions"
Environment
❯ npx envinfo --system --binaries --npmPackages netlify-cli --npmGlobalPackages netlify-cli
System: OS: macOS 12.4 CPU: (16) x64 Intel(R) Core(TM) i9-9980HK CPU @ 2.40GHz Memory: 919.10 MB / 32.00 GB Shell: 3.4.1 - /usr/local/bin/fish Binaries: Node: 18.6.0 - /usr/local/bin/node npm: 8.13.2 - /usr/local/bin/npm npmPackages: netlify-cli: ^10.11.1 => 10.11.1 npmGlobalPackages: netlify-cli: 10.11.1
Hey all 👋 Thanks for submitting @madsem. I'm having the exact same issue on windows + WSL (Ubuntu), with an Astro site. Let me know if there's anything I can do to help 😄
Not sure if it helps @MykalMachon, I removed webpack and babel and switched to esbuild.
Now everything is working again and my dev server starts :)
A simple workaround is to use node 16 for now.
The problem lies in the name resolution for localhost which as of node 17 sometimes gets resolved to ::1 and sometimes to 127.0.0.1.
We recently adapted our code to only use IPv4 (127.0.0.1), but if the framework uses localhost it might end up registering the port on IPv6.
Ref: #4806 Ref: #4835 Ref: #3617
@danez tried using Node 16 before I came here, it didn't change anything.
@MykalMachon scratch my previous reply, it just started happening again.
Edit:
❯ ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.051 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.078 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.078 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.058 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.049 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.076 ms
Right after the ping I ran netlify dev, same result. It just hangs
Here is the output on Node 16:
via v16.16.0 on ☁️ took 2s
❯ netlify dev
◈ Netlify Dev ◈
◈ Ignored general context env var: LANG (defined in process)
◈ Ignored general context env var: LC_ALL (defined in process)
◈ Injected .env file env var: ELEVENTY_ENV
◈ Injected .env file env var: SITE_ID
◈ Injected .env file env var: BROWSER
◈ Injected .env file env var: WCT_API_KEY
◈ Injected .env file env var: UPSTASH_REDIS_REST_URL
◈ Injected .env file env var: UPSTASH_REDIS_REST_TOKEN
◈ Injected .env file env var: IPDATA_API_KEY
◈ Loaded function offers.
◈ Loaded function query.
◈ Functions server is listening on 53603
◈ Starting Netlify Dev with Eleventy
> [email protected] dev
> run-p clean build:js build:css 11ty:dev
> [email protected] clean
> rimraf dist/*
> [email protected] build:js
> npx esbuild ./resources/js/main.js --outfile=./dist/assets/js/main.js --bundle --target=es2018 --minify
> [email protected] build:css
> npx tailwindcss -i ./resources/css/main.css -o ./dist/assets/css/main.css --minify
> [email protected] 11ty:dev
> ELEVENTY_ENV=development npx @11ty/eleventy --serve --watch
dist/assets/js/main.js 46.8kb
⚡ Done in 14ms
Done in 744ms.
[11ty] Writing dist/robots.txt from ./site/robots.njk
[11ty] Writing dist/pages/about/index.html from ./site/pages/about.md (njk)
[11ty] Writing dist/pages/contact/index.html from ./site/pages/contact.md (njk)
[11ty] Writing dist/index.html from ./site/index.njk
[11ty] Writing dist/pages/legal-disclosure/index.html from ./site/pages/legal-disclosure.md (njk)
[11ty] Writing dist/pages/terms-of-use/index.html from ./site/pages/terms-of-use.md (njk)
[11ty] Writing dist/pages/privacy-policy/index.html from ./site/pages/privacy-policy.md (njk)
[11ty] Writing dist/404.html from ./site/404.md (njk)
[11ty] Writing dist/9ffe3f93-8774-4e12-a1bf-540baec15ebb/index.html from ./site/landers.njk
[11ty] Writing dist/70ffc2c1-feb1-47ea-ac72-63b2411ee09c/index.html from ./site/landers.njk
[11ty] Writing dist/63e88395-9247-4b88-92c9-1ef649944149/index.html from ./site/landers.njk
[11ty] Benchmark 806ms 57% 1× (Data) `./site/_data/valhalla.js`
[11ty] Copied 5 files / Wrote 11 files in 1.08 seconds (98.2ms each, v1.0.1)
[11ty] Watching…
[Browsersync] Access URLs:
---------------------------------
Local: http://localhost:8081
External: http://172.20.10.5:8081
---------------------------------
[Browsersync] Serving files from: dist
⠸ Waiting for framework port 8080. This can be configured using the 'targetPort' property in the netlify.toml
It looks like that eleventy is running on port 8081 in your case, whereas netlify/cli is waiting for the default port 8080.
@danez, you lifesaver! :)
Amazing, thank you very much!!
It's weird though, there was nothing anywhere that configured 8081, I tried changing the port via --serve --port=8080, browsersync was still running on 8081 though.
So I changed the package.json to include npx @11ty/eleventy --serve --port=8081 --watch, then changed the netlify.toml targetPort to 8081, and it started to work.
Thanks again!
Worth noting that this might be an issue with Node 17/18 in the latest version of the CLI.
Using Node 16 without issue. Here is the issue I raised on the community: https://answers.netlify.com/t/netlify-cli-waiting-for-framework-port/73329/3
Yes hopefully, once this is merged and we update it should solve all these problems: https://github.com/dwmkerr/wait-port/pull/84
Yes hopefully, once this is merged and we update it should solve all these problems: dwmkerr/wait-port#84
Looks like it was merged and released
Could you try using version 12.0.2 and see if it works better?
Could you try using version 12.0.2 and see if it works better?
It works! Thanks!
@paulrudy FWIW - In my case the issue was that I had killed the app while there was a type error causing it to fail to compile. I forgot about this when I tried to fire it up the next morning. I finally realized my error after a couple of hours of installing every possible combination of Node version, Netlify version, and Angular CLI version.
It's embarrassing, but maybe it's worth posting if this helps someone.
Could you try using version 12.0.2 and see if it works better?
updating to v12.0.2 of netlify dev solved this for me as well. Very odd because it was only my Astro sites that were experiencing issues. Thanks for all the hard work ♥