question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"UnhandledPromiseRejectionWarning" in git bash

See original GitHub issue

When I ran nba-go g in a git bash tool on WIN10, the following error occurred:

(node:21280) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'width' of undefined
    at Object.render (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\cfonts\index.js:464:121)
    at Object.say (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\cfonts\index.js:536:23)
    at cfontsDate (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\lib\cli.js:2:41326)
    at C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\ramda\src\internal\_pipe.js:3:14
    at C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\ramda\src\internal\_arity.js:10:19
    at C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\lib\cli.js:2:21374
    at tryCatch (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\regenerator-runtime\runtime.js:62:40)
    at Generator.invoke [as _invoke] (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\regenerator-runtime\runtime.js:296:22)
    at Generator.prototype.(anonymous function) [as next] (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\regenerator-runtime\runtime.js:114:21)
    at step (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\babel-runtime\helpers\asyncToGenerator.js:17:30)
    at C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\babel-runtime\helpers\asyncToGenerator.js:35:14
    at new Promise (<anonymous>)
    at new F (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\core-js\library\modules\_export.js:36:28)
    at Object.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\babel-runtime\helpers\asyncToGenerator.js:14:12)
    at Object.I [as game] (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\lib\cli.js:2:24827)
    at Command.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\lib\cli.js:2:6890)
    at Command.listener (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\commander\index.js:315:8)
    at emitTwo (events.js:126:13)
    at Command.emit (events.js:214:7)
    at Command.parseArgs (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\commander\index.js:654:12)
    at Command.parse (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\node_modules\commander\index.js:474:21)
    at Object.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\nba-go\lib\cli.js:2:7875)
(node:21280) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:21280) [DEP0018] 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.

It seems that the window-size package is undefined. The error didn’t come up when using other CLI tool, like PowerShell and VSCode.

I’m using:

Win10 64
node v8.11.1
npm v5.6.0
nba-go v0.4.0

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:1
  • Comments:13

github_iconTop GitHub Comments

3reactions
simonkengcommented, Jan 12, 2019

Hi @qorrect, thanks so much for showing me the steps you took! I went through it and everything appeared to run properly, but mine is still hanging at Loading Game Schedule

Below is the edited code block I made in /nba-go/node_modules/nba-stats-client/build/NbaStatsClient.js

    key: 'getHeaders',
    value: function getHeaders() {
      return { 'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/45.0.2454.101 Safari/537.36',
        'referer': 'http://stats.nba.com/scores/', 'Connection': 'keep-alive', 'Accept-Language': 'en-US' };
    }

UPDATE:

It worked! Loading Game Schedule might take some time on the first go, but its much faster on successive runs. Thanks for your help @qorrect

3reactions
charlie-sanderscommented, Jan 12, 2019

Adding these headers worked for me too :

'Connection': 'keep-alive', 'Accept-Language': 'en-US'

in the getHeaders() function of NbaStatsClient.js in the nba-stats-client package, probably need to let them know.

Read more comments on GitHub >

github_iconTop Results From Across the Web

"UnhandledPromiseRejectionWarning" in git bash #79 - GitHub
This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not...
Read more >
UnhandledPromiseRejectionWar...
UnhandledPromiseRejectionWarning : Unhandled promise rejection error in windows but same code is working in Linux in Svelte · Do you use the same ......
Read more >
Understanding Self-Signed Certificate in Chain Issues on ...
js, npm, Git, and other applications. I worked for a company that has a hard Information Security policy. Since it's a big company,...
Read more >
Npm install command failing with message "could not find ...
... ERR! path C:\Users\ricar\Desktop\mflix-js\node_modules\weak-napi npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d ...
Read more >
Fixing UnhandledPromiseRejectionWarning in Node.js
There's a little problem though. It's very easy to forget to handle Promise rejections, and this can lead to hard-to-debug issues. If we...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found