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

detect-port-alt@1.1.5 fails with an Error: getaddrinfo ENOTFOUND #4189

Milestone

Comments

@halfzebra
Copy link
Contributor

halfzebra commented Mar 20, 2018

Is this a bug report?

Yes

Did you try recovering your dependencies?

Not relevant.

Which terms did you search for in User Guide?

(Write your answer here if relevant.)

Environment

  1. node -v: v9.7.1
  2. npm -v: v5.6.0
  3. yarn --version (if you use Yarn):
  4. npm ls react-scripts (if you haven’t ejected):

Then, specify:

  1. Operating system:
    MacOSX Sierra 10.12.6
    MacOSX Sierra 10.13.3
  2. Browser and version (if relevant):

Steps to Reproduce

(Write your steps here:)

  1. npm run start # fresh installation

Expected Behavior

If it's an error caused by the system configuration, it probably should suggest something meaningful.

Actual Behavior

This issue has been reported on a bunch of different repositories:
halfzebra/create-elm-app#239
node-modules/detect-port#29

The original maintainer @fengmk2 says it has been fixed in the original detect-port package.

Reproducible Demo

Not available.

@halfzebra halfzebra changed the title detect-port-alt fails with an Error: getaddrinfo ENOTFOUND detect-port-alt@1.1.5 fails with an Error: getaddrinfo ENOTFOUND Mar 20, 2018
@Timer Timer added this to the 2.0.0 milestone Mar 21, 2018
@greglearns
Copy link

greglearns commented Apr 2, 2018

A temporary solution:

Looking at create-react-app/packages/react-scripts/scripts/start.js, it appears that you can pass in environment variables:
Set the HOST env variable. e.g. HOST=localhost
And, optionally, also set the PORT=5000 or whatever port you want to use.

@bugzpodder
Copy link

I couldn't get the above solution to work, so I just manually edited node_modules/detect-port-alt/lib/detect-port.js and removed the checks around return callback as shown below.
listen(port, host, (err, realPort) => {
// ignore random listening
return callback(err, realPort);

@gaearon
Copy link
Contributor

gaearon commented Apr 3, 2018

Maybe we need to cherry-pick this fix? node-modules/detect-port@792bccd

@halfzebra
Copy link
Contributor Author

@greglearns most likely this is the solution!

How do we help to cherry-pick that stuff intodetect-port-alt?

@gaearon
Copy link
Contributor

gaearon commented Apr 3, 2018

@Timer might find time to do it

@Timer
Copy link
Contributor

Timer commented Apr 4, 2018

#4250

@Timer Timer closed this as completed Apr 4, 2018
@Timer
Copy link
Contributor

Timer commented Apr 4, 2018

This will be out in 1.1.4.

@Timer Timer modified the milestones: 2.0.0, 1.1.4 Apr 4, 2018
@Timer
Copy link
Contributor

Timer commented Apr 4, 2018

This is now released in react-scripts@1.1.4.

@gaearon
Copy link
Contributor

gaearon commented Apr 4, 2018

Thanks!

bors bot referenced this issue in mythmon/corsica-tree-status Apr 23, 2018
3: Update dependency flow-bin to v0.70.0 r=mythmon a=renovate[bot]

This Pull Request updates dependency [flow-bin](https://github.com/flowtype/flow-bin) from `v0.66.0` to `v0.70.0`




<details>
<summary>Commits</summary>

#### v0.67.1
-   [`4255e2d`](flow/flow-bin@4255e2d) v0.67.1
#### v0.68.0
-   [`aea9bb5`](flow/flow-bin@aea9bb5) v0.68.0
#### v0.69.0
-   [`b8a5da6`](flow/flow-bin@b8a5da6) v0.69.0
#### v0.70.0
-   [`0b0bcea`](flow/flow-bin@0b0bcea) v0.70.0

</details>



---

This PR has been generated by [Renovate Bot](https://renovateapp.com).

4: Update dependency react-scripts to v1.1.4 r=mythmon a=renovate[bot]

This Pull Request updates dependency [react-scripts](https://github.com/facebookincubator/create-react-app) from `v1.1.1` to `v1.1.4`



<details>
<summary>Release Notes</summary>

### [`v1.1.2`](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md#&#8203;112-April-3-2018)

##### 🐛 Bug Fix

* `react-scripts`

  * [#&#8203;4085](`https://github.com/facebook/create-react-app/pull/4085`) Resolve `.js` before `.mjs` files to unbreak dependencies with native ESM support. ([@&#8203;leebyron])
##### 📝 Documentation

* `react-scripts`

  * [#&#8203;4197](`https://github.com/facebook/create-react-app/pull/4197`) Add troubleshooting for Github Pages. ([@&#8203;xnt])
##### Committers: 2
- Lee Byron ([leebyron])
- Vicente Plata ([xnt])
##### Migrating from 1.1.1 to 1.1.2

Inside any created project that has not been ejected, run:

```
npm install --save --save-exact react-scripts@&#8203;1.1.2
```

or

```
yarn add --exact react-scripts@&#8203;1.1.2
```

---

### [`v1.1.3`](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md#&#8203;113-April-3-2018)

##### 🐛 Bug Fix

* `react-scripts`

  * [#&#8203;4247](`https://github.com/facebook/create-react-app/pull/4247`) Fix `environment.dispose is not a function` error caused by a Jest bug. ([@&#8203;gaearon])
##### Committers: 1
- Dan Abramov ([gaearon])
##### Migrating from 1.1.2 to 1.1.3

Inside any created project that has not been ejected, run:

```
npm install --save --save-exact react-scripts@&#8203;1.1.3
```

or

```
yarn add --exact react-scripts@&#8203;1.1.3
```

---

### [`v1.1.4`](https://github.com/facebookincubator/create-react-app/blob/master/CHANGELOG.md#&#8203;114-April-3-2018)

##### 🐛 Bug Fix

* `react-dev-utils`

  * [#&#8203;4250](`https://github.com/facebook/create-react-app/pull/4250`) Upgrade `detect-port-alt` to fix [#&#8203;4189](`https://github.com/facebook/create-react-app/issues/4189`). ([@&#8203;Timer])
##### Committers: 1
- Joe Haddad ([Timer])
##### Migrating from 1.1.3 to 1.1.4

Inside any created project that has not been ejected, run:

```
npm install --save --save-exact react-scripts@&#8203;1.1.4
```

or

```
yarn add --exact react-scripts@&#8203;1.1.4
```

---

</details>


<details>
<summary>Commits</summary>

#### v1.1.2
-   [`058d03f`](facebook/create-react-app@058d03f) Fix typos in example monorepo documentation. (#&#8203;4164)
-   [`1922f4d`](facebook/create-react-app@1922f4d) Allow ModuleScopePlugin accecpts an array as its appSrc (#&#8203;4138)
-   [`33f1294`](facebook/create-react-app@33f1294) Revert &quot;Change no-unused-vars &#x27;args&#x27; from none to all to show warning on destructured objects&quot;
-   [`8a34b7c`](facebook/create-react-app@8a34b7c) Add ESLint check for incorrect propTypes usage (#&#8203;3840) (#&#8203;4048)
-   [`8db5e33`](facebook/create-react-app@8db5e33) Revert lint-related changes made in #&#8203;4193 (#&#8203;4211)
-   [`06dd17e`](facebook/create-react-app@06dd17e) add `create-react-app --help` info for local file path `--scripts-version` support (#&#8203;4015)
-   [`9c167a4`](facebook/create-react-app@9c167a4) Add some stuff that requires transpilation. (#&#8203;4174)
-   [`da518d2`](facebook/create-react-app@da518d2) Fix floating caret position incorrect while scrolling overlay (#&#8203;4024)
-   [`2824bf2`](facebook/create-react-app@2824bf2) [next] Revert to use ecma 5 in uglifyOptions (#&#8203;4234)
-   [`9a99b5d`](facebook/create-react-app@9a99b5d) Fix typo and be clearer about `ecma` settings in uglifyjs options (#&#8203;4239)
-   [`9c3f03c`](facebook/create-react-app@9c3f03c) use the lastest url of gitignore file (#&#8203;4236)
#### v1.1.3
-   [`061d1e4`](facebook/create-react-app@061d1e4) Add troubleshooting for Github Pages (#&#8203;4197)
-   [`2e690e9`](facebook/create-react-app@2e690e9) Add 1.1.2 changelog (#&#8203;4242)
#### v1.1.4
-   [`3b102fe`](facebook/create-react-app@3b102fe) Work around Jest environment resolving bug (#&#8203;4247)
-   [`90c908e`](facebook/create-react-app@90c908e) Changelog for 1.1.3
-   [`2762924`](facebook/create-react-app@2762924) Update detect-port-alt

</details>



---

This PR has been generated by [Renovate Bot](https://renovateapp.com).

Co-authored-by: Renovate Bot <bot@renovateapp.com>
@soda-x
Copy link

soda-x commented Jul 31, 2018

@Timer @greglearns

detect-port-alt@1.1.6 still has the bug

// 1. check specified host (or null)
  listen(port, host, (err, realPort) => {
    // ignore random listening
    if (port === 0) {
      return callback(err, realPort);
    }

    if (err) {
      return handleError(err);
    }

    // 2. check default host
    listen(port, null, err => {
      if (err) {
        return handleError(err);
      }

      // 3. check localhost <------localhost should be optional, it depends on /etc/hosts
      listen(port, 'localhost', err => { 
        if (err) {
          return handleError(err);
        }

@soda-x
Copy link

soda-x commented Jul 31, 2018

And what's the difference between detect-port-alt and detect-port? Why not send a PR to dectect-port? If you think it is necessary to fork detect-port so please let us know the repo address then I can make a PR for you.

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