You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
UnhandledPromiseRejectionWarning on Node 7.7.2 #1776
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:
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
node -v:
v7.7.2
npm -v:
4.3.0
Then, specify:
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
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.
Reacted by Arthur, Roman Datsiuk, James McAllister, Anej Gorkič, James, Cory Robinson, ZoranZilicFTN and AJ
Reacted by James McAllister, Cory Robinson and ZoranZilicFTN
We do not support Node 7, so the official recommendation would be to downgrade to the latest LTS.
Currently, that is Node v6.10.0.
However, we understand this might be desirable. Would one of you like to send a PR adding Node 7 to the CI (only one of the test cases) and resolving this issue?
Thanks!
I get the same error in MacOS El Capitan and Ubuntu (both node 7). Weird thing is that in Ubuntu it still runs and starts the server, but doesnt detect any changes to files. In MacOS, it just quits.
After upgrading detect-port in react-scripts to 1.1.0, I can run create-react-app without any issues on node 4.8.0, 6.10.0 and 7.7.2. So upgrading it could still be a solution, without impacting the minimal node version.
Travis/tests failing on detect-port:1.1.0 with node <6 as mentioned earlier, seem to be related to its test dependency only. It doesn't withhold the package from working on node <6 when used with react-scripts. Though, I'm not sure if this may influence any other create-react-app tests somehow.
Activity
whelmich commentedon Mar 9, 2017
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.
whelmich commentedon Mar 9, 2017
This problem seems to be caused by
detect-port:1.0.1, used by react-scripts. It causes an error indetect-port/lib/detect-port.json line 61socket.connect(...).detect-portis 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-portseems 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-scriptsis>=4I am not sure if upgrading the version ofdetect-portinpackage.jsoninreact-scriptsis an acceptable solution asdetect-ports:1.1.0only passes its test on node version>=6.Timer commentedon Mar 9, 2017
We do not support Node 7, so the official recommendation would be to downgrade to the latest LTS.
Currently, that is Node v6.10.0.
However, we understand this might be desirable. Would one of you like to send a PR adding Node 7 to the CI (only one of the test cases) and resolving this issue?
Thanks!
/cc @whelmich
gaearon commentedon Mar 9, 2017
(We definitely should support Node 7 tho)
taivu commentedon Mar 9, 2017
I get the same error in MacOS El Capitan and Ubuntu (both node 7). Weird thing is that in Ubuntu it still runs and starts the server, but doesnt detect any changes to files. In MacOS, it just quits.
Timer commentedon Mar 9, 2017
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?
gaearon commentedon Mar 9, 2017
I don't think we should skip supported versions, it would be confusing.
vhain commentedon Mar 9, 2017
It can be bug of Node 7.7.2 and if it is, it should be fixed by nodejs/node#11762
+i think that promise should be
catchsomewhereTimer commentedon Mar 9, 2017
Ah, brilliant @vhain! This definitely looks like a regression then. 😄
[-]UnhandledPromiseRejectionWarning in Windows 10[/-][+]UnhandledPromiseRejectionWarning on Node 7.7.2[/+]whelmich commentedon Mar 9, 2017
After upgrading
detect-portin react-scripts to 1.1.0, I can run create-react-app without any issues on node 4.8.0, 6.10.0 and 7.7.2. So upgrading it could still be a solution, without impacting the minimal node version.Travis/tests failing on
detect-port:1.1.0with node <6 as mentioned earlier, seem to be related to its test dependency only. It doesn't withhold the package from working on node <6 when used with react-scripts. Though, I'm not sure if this may influence any other create-react-app tests somehow.gaearon commentedon Mar 9, 2017
Want to send a PR enabling tests on Node 7 + bumping the version?
19 remaining items
mnemanja commentedon Mar 17, 2017
@gaearon
Thanks,
removing node_modules completely and installing all the dependencies fixed the issue for me.
Thanks for the hint @Timer, I'll be sure to remember it next time something like this happens.
Keep up the good work guys :)
gaearon commentedon Mar 17, 2017
Looks like we need to bump
detect-portto 1.1.1: node-modules/detect-port#16 (comment)PR, anyone?
Andreyco commentedon Mar 20, 2017
cc @gaearon PR opened #1861
Can confirm,
detect-portpicks next available port as expected.Update react-scripts to 0.9.5
Run CI on Node 7; Bump detect-port: 1.0.1 -> 1.1.0 (react#1776) (reac…
Run CI on Node 7; Bump detect-port: 1.0.1 -> 1.1.0 (react#1776) (reac…
Merge upstream changes from create-react-app 0.9.x (#84)
[chore]: upgrade react-scripts to latest
Merge upstream create-react-app v1.0.7 (#90)
taykcrane commentedon Aug 21, 2017
For any newbies running into this bug, I fixed it by downgrading NPM to the LTS (latest stable version) of 6.11.2.
davidcalhoun commentedon Dec 19, 2017
Had a similar issue using npm to install. Fixed by removing both
npm-modulesandpackage-lock.json(a variant of @gaearon's comment above)shiziChing commentedon Feb 7, 2018
说中文撒大佬们