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

Node.js giving UnhandledPromiseRejectionWarning, even for code that doesn't have an unhandled promise rejection #1091

Closed
DragonOsman opened this issue Feb 2, 2018 · 4 comments

Comments

@DragonOsman
Copy link

I tried to run the parcel index.html command to build country-currency-map (a Node.js module), but I had an "UnhandledPromiseRejectionWarning" even though the library reportedly doesn't have an unhandled promise rejection. Trying to do the "Getting Started" example on the Parcel.js page has the same result. I already uninstalling and reinstalling Node.js and I even installed the latest version. Still doesn't work.

I'm using Windows 10. I also have WSL. When I try to run the commands in the bash shell, though, I get an error saying "parcel: node: not found" even though I did install Node.js in WSL mode as well. And it's also on my PATH.

@evanlucas
Copy link

Setting the NODE_OPTIONS environment variable to --trace-warnings should print out a stack trace for unhandled rejections (depending on what version of node you are using)

@DragonOsman
Copy link
Author

Sorry for noob-question, but: Where do I set that?

@evanlucas
Copy link

@DragonOsman apologies, but I'm not a Windows user. A quick google search shows this. Hopefully, that helps! Thanks! :]

@gireeshpunathil
Copy link
Member

you could also set it on the command prompt:
set NODE_OPTIONS="--trace-warnings" as a one time business (the setting expires along with the shell session).

More simpler, you could add the option in-line to the node command (the setting lives only for the node command)

D:\home\gireesh>cat foo.js
require('util').debug('hello')

D:\home\gireesh>node --trace-warnings foo.js
DEBUG: hello
(node:11724) [DEP0028] DeprecationWarning: util.debug is deprecated. Use console.error instead.
    at Object.<anonymous> (D:\home\gireesh\foo.js:1:79)
    at Module._compile (module.js:662:30)
    at Object.Module._extensions..js (module.js:673:10)
    at Module.load (module.js:575:32)
    at tryModuleLoad (module.js:515:12)
    at Function.Module._load (module.js:507:3)
    at Function.Module.runMain (module.js:703:10)
    at startup (bootstrap_node.js:193:16)
    at bootstrap_node.js:665:3

closing as answered, please let me know if you have additional questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants