create-react-app: UnhandledPromiseRejectionWarning on Node 7.7.2

Description

Bug

Expected behavior

npm start

should not return a UnhandledPromiseRejectionWarning

Actual behavior

cschroeter@pc:~/workspace/my-first-react-app$ npm start

> test@0.1.0 start /home/cschroeter/workspace/my-first-react-app
> react-scripts start

(node:1863) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: "listener" argument must be a function
(node:1863) DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Environment

Run these commands in the project folder and fill in their results:

  1. npm ls react-scripts (if you haven’t ejected):
cschroeter@pc:~/workspace/my-first-react-app$ npm ls react-scripts
my-frist-react-app@0.1.0 /home/cschroeter/workspace/my-frist-react-app
└── react-scripts@0.9.4
  1. node -v:
v7.7.2
  1. npm -v:
4.3.0

Then, specify:

  1. Operating system: Windows 10 in Linux Bash Shell Build 15048 (Creator Update)

To Reproduce

$ create-react-app my-first-react-app
$ cd my-first-react-app
$ npm start

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 34
  • Comments: 33 (20 by maintainers)

Commits related to this issue

Most upvoted comments

说中文撒大佬们

(We definitely should support Node 7 tho)

This problem seems to be caused by detect-port:1.0.1, used by react-scripts. It causes an error in detect-port/lib/detect-port.js on line 61 socket.connect(...).

detect-port is currently at version 1.1.0 which features a different approach of port detection. This version resolves the error for node v7.7.2, and also works with 7.6.0 and 7.7.1.

The Travis build test of version 1.1.0 of detect-port seems to fail, because the test is using node v4.8.0. On node 7.6.0, 7.7.1 and 7.7.2 the tests complete without any problems.

As the minimum node version of react-scripts is >=4 I am not sure if upgrading the version of detect-port in package.json in react-scripts is an acceptable solution as detect-ports:1.1.0 only passes its test on node version >=6.

(We definitely should support Node 7 tho)

We should probably run all test cases on Node 7 then. 🤷‍♀️

Node 8 comes out in a month though, which I assume means we would drop Node 7 support. Worth waiting?

Can reproduce in Linux Mint 18.1 with the same node/npm versions.

Problem can be resolved by downgrading node to 7.7.1 or older. The problem appeared after upgrading node to 7.7.2.

Try deleting node_modules and running install again. Also make sure your yarn.lock doesn’t have the old version somehow.

For any newbies running into this bug, I fixed it by downgrading NPM to the LTS (latest stable version) of 6.11.2.

It can be bug of Node 7.7.2 and if it is, it should be fixed by https://github.com/nodejs/node/pull/11762

+i think that promise should be catch somewhere

I wanna state that for me this isn’t a blocking problem, just a pesky one 😃

I don’t think we should skip supported versions, it would be confusing.

Ah, brilliant @vhain! This definitely looks like a regression then. 😄