netlify / cli

Netlify Command Line Interface
http://cli.netlify.com
MIT License
1.58k stars 352 forks source link

Systems without IPv6 support crash netlify dev #5166

Closed cfjedimaster closed 2 years ago

cfjedimaster commented 2 years ago

Describe the bug

For a very long time, I used the following to start my Eleventy site:

netlify dev -c "eleventy --serve --quiet"

A week or so ago, it began throwing an error:

 Starting Netlify Dev with Eleventy
✖ Waiting for framework port 8080. This can be configured using the 'targetPort' property in the netlify.toml
◈ Netlify Dev could not connect to localhost:8080.
◈ Please make sure your framework server is running on port 8080

What's interesting is that the error would throw right away. It didn't wait for Eleventy to start. I confirmed localhost worked via ping, and I could still run eleventy in my directory just fine.

You can see my forum post here: https://answers.netlify.com/t/ntl-dev-no-longer-working-with-eleventy/76968

This morning, I noticed how it said "with Eleventy", and I realized the CLI recognized Eleventy and was maybe assuming it was running already? On a whim, I tried this in my toml:

[dev]
  framework = "#static"

And voila, it worked. It correctly ran the command to start Eleventy.

So my question is - what changed here?

Steps to reproduce

With an Eleventy site, try running it as described above (with -c), and see if the CLI doesn't launch Eleventy.

Configuration

No response

Environment


  System:
    OS: Linux 5.15 Ubuntu 22.04.1 LTS 22.04.1 LTS (Jammy Jellyfish)
    CPU: (20) x64 Intel(R) Core(TM) i9-10900K CPU @ 3.70GHz
    Memory: 9.28 GB / 15.46 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 14.18.0 - ~/.nvm/versions/node/v14.18.0/bin/node
    npm: 7.24.1 - ~/.nvm/versions/node/v14.18.0/bin/npm
  npmGlobalPackages:
    netlify-cli: 12.0.9
brittneypostma commented 2 years ago

A temporary fix for this is

[dev]
  targetPort = "8080

I had a similar issue with SvelteKit when it switched to Vite's 5173 port. The framework info needed to be updated in the json file.

cfjedimaster commented 2 years ago

Adding targetPort didn't work for me.

brittneypostma commented 2 years ago

Oh, that's odd. I think what happened and why it started working when you changed to static is that it stopped detecting the framework with eleventy.json. I'm not familiar with Eleventy, do you notice anything wrong with the json file?

cfjedimaster commented 2 years ago

Well that's the thing - it did detect Eleventy. I saw that in the output, but it didn't fire it up like it used to.

danez commented 2 years ago

Can you please test with version 12.0.10? This new version should show the underlying error in this case, because if it instantly throws that means something went wrong before it even started to wait for the port.

cfjedimaster commented 2 years ago

Big paste coming in.

ray@Hoth:~/projects/raymondcamden2020$ netlify dev -c "eleventy --serve --quiet"
◈ Netlify Dev ◈
◈ Injected site settings env var: ALG_API_KEY
◈ Injected site settings env var: ALG_APP_ID
◈ Injected site settings env var: GOOGLE_GA_CREDS
◈ Injected site settings env var: GOOGLE_GA_PROPERTY
◈ Injected site settings env var: MC_API
◈ Injected site settings env var: NETLIFY_SITE_ID
◈ Injected site settings env var: NETLIFY_TOKEN
◈ Injected site settings env var: NODE_OPTIONS
◈ Injected site settings env var: NODE_VERSION
◈ Injected site settings env var: SENDGRID
◈ Ignored general context env var: LANG (defined in process)
◈ Loaded function latestTracks http://localhost:8888/.netlify/functions/latestTracks.
◈ Loaded function deploy-status http://localhost:8888/.netlify/functions/deploy-status.
◈ Loaded function deploy-succeeded http://localhost:8888/.netlify/functions/deploy-succeeded.
◈ Loaded function get-cats http://localhost:8888/.netlify/functions/get-cats.
◈ Loaded function getPageViews http://localhost:8888/.netlify/functions/getPageViews.
◈ Loaded function netlifyGraph http://localhost:8888/.netlify/functions/netlifyGraph.
◈ Loaded function newsletter-signup http://localhost:8888/.netlify/functions/newsletter-signup.
◈ Loaded function sendComments http://localhost:8888/.netlify/functions/sendComments.
◈ Functions server is listening on 33433
◈ Setting up local development server
​
────────────────────────────────────────────────────────────────
  Netlify Build
────────────────────────────────────────────────────────────────
​
❯ Version
  @netlify/build 28.0.0
​
❯ Flags
  {}
​
❯ Current directory
  /home/ray/projects/raymondcamden2020
​
❯ Config file
  /home/ray/projects/raymondcamden2020/netlify.toml
​
❯ Context
  dev
​
❯ Loading plugins
   - @netlify/plugin-lighthouse@4.0.1 from Netlify app
​
────────────────────────────────────────────────────────────────
  1. Run command for local development
────────────────────────────────────────────────────────────────
​
◈ Starting Netlify Dev with Eleventy
✖ Waiting for framework port 8080. This can be configured using the 'targetPort' property in the netlify.toml
◈ Netlify Dev could not start or connect to localhost:8080.
◈ Please make sure your framework server is running on port 8080
​
────────────────────────────────────────────────────────────────
  Internal error during "dev.command"
────────────────────────────────────────────────────────────────
​
  Error message
  ConnectionError: The address 'localhost' cannot be found
​
  Error location
  During dev.command
      at /home/ray/.nvm/versions/node/v18.9.1/lib/node_modules/netlify-cli/node_modules/wait-port/lib/wait-port.js:118:27
      at Socket.<anonymous> (/home/ray/.nvm/versions/node/v18.9.1/lib/node_modules/netlify-cli/node_modules/wait-port/lib/wait-port.js:25:5)
      at Socket.emit (node:events:513:28)
      at Socket.emit (node:domain:489:12)
      at emitErrorNT (node:internal/streams/destroy:151:8)
      at emitErrorCloseNT (node:internal/streams/destroy:116:3)
      at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
​
  Error properties
  { name: 'ConnectionError' }
​
  Resolved config
  build:
    command: npx eleventy --quiet
    commandOrigin: ui
    publish: /home/ray/projects/raymondcamden2020/_site
    publishOrigin: ui
  functionsDirectory: /home/ray/projects/raymondcamden2020/.functions
  plugins:
    - inputs: {}
      origin: ui
      package: '@netlify/plugin-lighthouse'
  redirects:
    - from: /api/getPageViews
      to: /.netlify/functions/getPageViews
    - from: /api/latestTracks
      status: 200
      to: /.netlify/functions/latestTracks
    - from: /index.cfm/2013/5/20/Capturing-camerapicture-data-without-PhoneGap
      status: 301
      to: /2013/05/20/capturing-camerapicture-data-without-phonegap/
    - from: /index.cfm/2012/3/9/PhoneGaps-File-API
      status: 301
      to: /2012/03/09/PhoneGaps-File-API
    - from: /2014/11/7/Cordova-and-Asset-Downloads/
      status: 301
      to: /2014/11/07/Cordova-and-Asset-Downloads/
    - from: /2013/5/20/Capturing-camerapicture-data-without-PhoneGap/
      to: /2013/05/20/capturing-camerapicture-data-without-phonegap/
    - from: /2011/1/12/Diagnosing-a-CFHTTP-issue--peer-not-authenticated/
      to: /2011/01/12/Diagnosing-a-CFHTTP-issue-peer-not-authenticated/
    - from: /2014/9/25/IndexedDB-on-iOS-8--Broken-Bad/
      to: /2014/09/25/IndexedDB-on-iOS-8-Broken-Bad/
    - from: /2014/7/2/GapDebug-a-new-mobile-debugging-tool/
      to: /2014/07/02/GapDebug-a-new-mobile-debugging-tool/
    - from: /2014/7/9/Cordova-Plugin-update-and-new-Contacts-demo/
      to: /2014/07/09/Cordova-Plugin-update-and-new-Contacts-demo
    - from: /2014/11/5/Cordova-Example-Writing-to-a-file/
      to: /2014/11/05/Cordova-Example-Writing-to-a-file/
    - from: /2014/09/24/Browser-as-a-platform-for-your-PhoneGapCordova-apps/
      to: /2014/09/24/browser-as-a-platform-for-your-phonegapcordova-apps
    - from: /2012/7/23/Adding-a-background-image-to-a-revealjs-presentation/
      to: /2012/07/23/Adding-a-background-image-to-a-revealjs-presentation/
    - from: /2014/10/7/Cordova-and-Large-Asset-Downloads--An-Abstract/
      to: /2014/10/07/Cordova-and-Large-Asset-Downloads-An-Abstract/
    - from: /2014/11/7/Cordova-and-Asset-Downloads/
      to: /2014/11/07/Cordova-and-Asset-Downloads/
    - from: /2013/5/1/Using-the-Progress-event-in-PhoneGap-file-transfers/
      to: /2013/05/01/Using-the-Progress-event-in-PhoneGap-file-transfers/
    - from: /2014/6/23/Cordova-Media-API-Example/
      to: /2014/06/23/Cordova-Media-API-Example/
    - from: /2011/2/16/Offtopic-and-NSFW--blog-post--Dead-Island-Trailer
      to: /2011/02/16/Offtopic-and-NSFW-blog-post-Dead-Island-Trailer
    - from: /index.cfm/2013/5/20/Capturing-camerapicture-data-without-PhoneGap
      to: /2013/05/20/capturing-camerapicture-data-without-phonegap/
    - from: /index.cfm/2011/10/20/Example-of-PhoneGaps-Database-Support
      to: /2011/10/20/example-of-phonegaps-database-support/
    - from: /index.cfm/2013/11/5/Ripple-is-Reborn
      to: /2013/11/05/Ripple-is-Reborn/
    - from: /index.cfm/2012/5/5/Converting-a-dynamic-web-site-to-a-PhoneGap-application
      to: /2012/05/05/converting-a-dynamic-web-site-to-a-phonegap-application/
    - from: /index.cfm/2011/11/10/Example-of-serverbased-login-with-PhoneGap
      to: /2011/11/10/Example-of-serverbased-login-with-PhoneGap/
    - from: /index.cfm/2012/3/27/Example-of-Autocomplete-in-jQuery-Mobile
      to: /2012/03/27/Example-of-Autocomplete-in-jQuery-Mobile/
    - from: /index.cfm/2013/10/1/MultiFile-Uploads-and-Multiple-Selects
      to: /2013/10/01/MultiFile-Uploads-and-Multiple-Selects/
    - from: /2014/10/1/Cordova-Plugins-and-Determining-what-supports-what
      to: /2014/10/01/Cordova-Plugins-and-Determining-what-supports-what
    - from: /2014/10/3/Figuring-out-what-version-of-Cordova-created-a-project
      to: /2014/10/03/Figuring-out-what-version-of-Cordova-created-a-project
    - from: /demos/*
      to: /olddemos
    - from: /index.cfm/2012/3/9/PhoneGaps-File-API
      to: /2012/03/09/PhoneGaps-File-API
    - from: /index.cfm/2013/7/11/Delaying-an-Edge-Animate-asset-until-visible--Part-2
      to: /2013/07/11/Delaying-an-Edge-Animate-asset-until-visible-Part-2
    - from: /index.cfm/2013/5/13/JavaScript-Design-Patterns--The-Revealing-Module-Pattern
      to: /2013/05/13/JavaScript-Design-Patterns-The-Revealing-Module-Pattern/
    - from: /index.cfm/2009/2/10/An-Introduction-to-jQuery-and-Form-Validation-2
      to: /2009/02/10/An-Introduction-to-jQuery-and-Form-Validation-2/
    - from: /index.cfm/2011/4/13/Simple-introduction-to-Google-Maps-Part-2--Markers
      to: /2011/04/13/Simple-introduction-to-Google-Maps-Part-2-Markers/
    - from: /index.cfm/2012/7/30/Example-of-form-validation-in-a-jQuery-Mobile-Application
      to: /2012/07/30/Example-of-form-validation-in-a-jQuery-Mobile-Application/
    - from: /index.cfm/2013/4/3/Delaying-an-Edge-Animate-asset-until-visible
      to: /2013/04/03/Delaying-an-Edge-Animate-asset-until-visible/
    - from: /index.cfm/2013/9/10/Adding-a-file-display-list-to-a-multifile-upload-HTML-control
      to: /2013/09/10/Adding-a-file-display-list-to-a-multifile-upload-HTML-control/
    - from: /index.cfm/2011/7/11/Quick-followup-to-my-CFSpreadSheet-Samples
      to: /2011/07/11/Quick-followup-to-my-CFSpreadSheet-Samples/
    - from: /index.cfm/2011/8/6/Quick-demo-of-jQuery-and-Google-Maps
      to: /2011/08/06/Quick-demo-of-jQuery-and-Google-Maps/
    - from: /index.cfm/2010/9/13/Guest-Post-Apple-Push-Notifications-From-ColdFusion-in-Ten-Minutes-or-Less
      to: /2010/09/13/Guest-Post-Apple-Push-Notifications-From-ColdFusion-in-Ten-Minutes-or-Less/
    - from: /index.cfm/2014/5/24/PhoneGap-Tip-Temporarily-changing-orientation-for-video-in-a-portrait-only-application
      to: /2014/05/24/phonegap-tip-temporarily-changing-orientation-for-video-in-a-portrait-only-application/
    - from: /2014/5/24/PhoneGap-Tip-Temporarily-changing-orientation-for-video-in-a-portrait-only-application
      to: /2014/05/24/phonegap-tip-temporarily-changing-orientation-for-video-in-a-portrait-only-application/
    - from: /2014/05/24/PhoneGap-Tip-Temporarily-changing-orientation-for-video-in-a-portrait-only-application
      to: /2014/05/24/phonegap-tip-temporarily-changing-orientation-for-video-in-a-portrait-only-application/
    - from: /page.cfm/Guide-to-ColdFusion-Administrator-Extensions
      to: https://static.raymondcamden.com/guide.html
    - from: /index.cfm/2011/6/1/ColdFusion-Sample--Create-an-Excel-File
      to: /2011/06/01/ColdFusion-Sample-Create-an-Excel-File/
    - from: /2012/2/28/Working-with-HTML5s-multiple-file-upload-support
      to: /2012/02/28/Working-with-HTML5s-multiple-file-upload-support
    - from: /2012/1/13/Demo-of-color-palettes-and-phonegap
      to: /2012/01/13/Demo-of-color-palettes-and-phonegap
    - from: /index.cfm/2012/6/14/Example-of-a-dynamic-HTML5-datalist-control
      to: /2012/06/14/example-of-a-dynamic-html5-datalist-control/
    - from: /index.cfm/2012/6/12/Posted-my-first-Brackets-Extension--CSSLint
      to: /2012/06/12/Posted-my-first-Brackets-Extension-CSSLint/
    - from: /index.cfm/2012/7/26/How-I-debugged-a-Flashbased-uploader-issue
      to: /2012/07/26/How-I-debugged-a-Flashbased-uploader-issue/
    - from: /index.cfm/2012/7/15/How-to-add-a-panel-to-Chrome-Dev-Tools
      to: /2012/07/15/How-to-add-a-panel-to-Chrome-Dev-Tools/
    - from: /index.cfm/2012/1/10/Using-a-server-or-session-storage-to-persist-form-values
      to: /2012/01/10/Using-a-server-or-session-storage-to-persist-form-values/
    - from: /index.cfm/2012/4/3/Adding-database-synchronization-to-your-PhoneGap-project
      to: /2012/04/03/adding-database-synchronization-to-your-phonegap-project/
    - from: /index.cfm/2012/2/24/Getting-URL-parameters-in-a-jQuery-Mobile-page
      to: /2012/02/24/Getting-URL-parameters-in-a-jQuery-Mobile-page
    - from: /index.cfm/2011/2/11/Two-quick-Applicationcfc-questions
      to: /2011/02/11/Two-quick-Applicationcfc-questions
    - from: /index.cfm
      to: /
    - from: /rss.cfm
      to: /feed.xml
    - from: /rss
      to: /feed.xml
    - from: /feeds
      to: /feed.xml
    - from: /index.xml
      to: /feed.xml
    - from: /feed
      to: /feed.xml
    - from: /index.cfm/2014/3/18/Brackets-Sprint-37-and-Upcoming-Hackathon
      to: /2014/03/18/Brackets-Sprint-37-and-Upcoming-Hackathon
    - from: /2008/3/3/Adding-an-ADD-button-for-cfgrid
      to: /2008/03/03/Adding-an-ADD-button-for-cfgrid
    - from: /demos/*
      status: 301
      to: /olddemos
    - from: /index.cfm/2011/2/17/What-tags-does-your-browser-support
      to: /2011/02/17/What-tags-does-your-browser-support
    - from: /forums/messages.cfm
      to: /
    - from: /forums/threads.cfm
      to: /
    - from: /wp-login.php
      to: /
    - from: /forums/login.cfm
      to: /
    - from: /index.cfm/2014/1/13/HTML5-Input-Patterns-and-Invalid-Regex
      to: /2014/01/13/HTML5-Input-Patterns-and-Invalid-Regex
    - from: /img/caniusewidget.png
      to: /
    - from: /tags/front-end-interview-questions
      to: /tags/front+end+interview+questions
    - from: /page/*
      to: /
    - from: index.cfm/2013/5/23/Video-Tutorial-Installing-the-Ripple-Emulator-for-PhoneGap-Development
      to: /2013/05/23/Video-Tutorial-Installing-the-Ripple-Emulator-for-PhoneGap-Development
    - from: index.php
      to: /
    - from: admin/index.php
      to: /
    - from: /index.cfm/2005/7/30/www.cfmbb.org
      to: /
    - from: /index.cfm/2012/10/31/Adding-Parsecom-User-support-to-your-PhoneGap-application
      to: /2012/10/31/Adding-Parsecom-User-support-to-your-PhoneGap-application
    - from: /index.php/component/users/
      to: /
    - from: /index.cfm/2011/3/28/Detecting-mobile-and-providing-a-way-out
      to: /2011/03/28/Detecting-mobile-and-providing-a-way-out
    - from: /2014/8/16/Ionic-and-Cordovas-DeviceReady--My-Solution
      to: /2014/08/16/Ionic-and-Cordovas-DeviceReady-My-Solution
    - from: /index.cfm/2012/6/19/ColdFusion-10-Missing-Feature--Form-Fields-and-Arrays
      to: /2012/06/19/ColdFusion-10-Missing-Feature-Form-Fields-and-Arrays
    - from: /2013/7/10/Quick-note-for-Parse-and-JavaScript-Users
      to: /2013/07/10/Quick-note-for-Parse-and-JavaScript-Users
    - from: /index.cfm/2012/11/1/Some-tips-for-working
      to: /2012/11/01/Some-tips-for-working-with-Data-Import-Handlers-in-ColdFusion-10
    - from: /2013/4/3/Delaying-an-Edge-Animate-asseset-until-visible--Part-6
      to: /2013/04/03/Delaying-an-Edge-Animate-asset-until-visible
    - from: /index.cfm/2011/7/26/How-are-Facebook-and-Google-creating-link-previews
      to: /2011/07/26/How-are-Facebook-and-Google-creating-link-previews
    - from: /2014/9/23/Simple-photo-filters-with-VintageJS-and-Cordova
      to: /2014/09/23/Simple-photo-filters-with-VintageJS-and-Cordova
    - from: /index.cfm/2009/3/11/Writing-a-JSONP-service-in-ColdFusion
      to: /2009/03/11/Writing-a-JSONP-service-in-ColdFusion
    - from: /index.cfm/2013/1/21/Did-you-know--Safari-Remote-Debugging-and-PhoneGap
      to: /2013/01/21/Did-you-know-Safari-Remote-Debugging-and-PhoneGap
    - from: /index.cfm/2008/6/3/Be-careful-with-returnFormat-and-JSON
      to: /2008/06/03/Be-careful-with-returnFormat-and-JSON
    - from: /2019/08/08/drag-and-drop-file-upload-in-vuejs/single.txt
      to: /2019/08/08/drag-and-drop-file-upload-in-vuejs/
    - from: /index.cfm/2010/6/30/Flash-Remoting-onCFCRequest-Issue
      to: /2010/06/30/Flash-Remoting-onCFCRequest-Issue
    - from: /wp-content/*
      to: https://static.raymondcamden.com/wp-content/:splat
    - from: /index.cfm/2008/7/7/Friday-Puzzler-a-bit-early
      to: /2008/07/07/Friday-Puzzler-a-bit-early
    - from: /wp-includes/wlwmanifest.xml
      to: /
    - from: /wordpress/wp-includes/wlwmanifest.xml
      to: /
    - from: /blog/wp-includes/wlwmanifest.xml
      to: /
    - from: /cms/wp-includes/wlwmanifest.xml
      to: /
    - from: /news/wp-includes/wlwmanifest.xml
      to: /
    - from: /sito/wp-includes/wlwmanifest.xml
      to: /
    - from: /web/wp-includes/wlwmanifest.xml
      to: /
 ›   Error: Could not start local development server

The address 'localhost' cannot be found

ConnectionError: The address 'localhost' cannot be found
    at /home/ray/.nvm/versions/node/v18.9.1/lib/node_modules/netlify-cli/node_modules/wait-port/lib/wait-port.js:118:27
    at Socket.<anonymous> (/home/ray/.nvm/versions/node/v18.9.1/lib/node_modules/netlify-cli/node_modules/wait-port/lib/wait-port.js:25:5)
    at Socket.emit (node:events:513:28)
    at Socket.emit (node:domain:489:12)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
ray@Hoth:~/projects/raymondcamden2020$

I really think the 'localhost cant be found thing' is a misfire, and this is the important bit:

Please make sure your framework server is running on port 8080

Previously, the CLI would use my -c to fire up Eleventy.

danez commented 2 years ago

I was able to reproduce this on Ubuntu with IPv6 completely disabled. I will start creating a fix for this.

Can you confirm that IPv6 is disabled on your machine? For example doing nslookup localhost should only print 127.0.0.1 but not ::1.

danez commented 2 years ago

This should be solved with 12.0.11.

If the problem persists please reopen.

cfjedimaster commented 2 years ago

I used the techniques here, https://www.golinuxcloud.com/linux-check-ipv6-enabled/, and from what I can tell, IPv6 is not disabled, but, I updated, and everything works now, so the problem is fixed. :) Thank you.

Oh, as an aside, nslookup localhost returned something weird:

Server:         1.1.1.1
Address:        1.1.1.1#53

** server can't find localhost: NXDOMAIN

Should I be concerned?