vercel / pkg

Package your Node.js project into an executable
https://npmjs.com/pkg
MIT License
24.33k stars 1.02k forks source link

Better error message than "AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value" #1938

Closed samuelko123 closed 1 year ago

samuelko123 commented 1 year ago

What version of pkg are you using?

5.8.1

What version of Node.js are you using?

16.13.0

What operating system are you using?

Windows

What CPU architecture are you using?

x86_64

What Node versions, OSs and CPU architectures are you building for?

node14-win-x64

Describe the Bug

Basically, it is a re-open of #1631.

If I'm on VPN and trying to fetch Node.js source, it will give error message like this: image

If I comment out this line: image

Then I will get this error, which is more comprehensible: image

I understand it's an upstream issue (pkg-fetch), but I'll leave it here for you to coordinate with pkg-fetch. After all, I'm using pkg.

Expected Behavior

Display this error: Error! FetchError: request to https://nodejs.org/dist/v14.20.0/SHASUMS256.txt failled, reason: unable to get local issuer certificate

Instead of this error: Error! AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

To Reproduce

  1. Make sure you're on VPN
  2. Delete the PKG_CACHE_PATH folder (For me, it's C:\Users\<user>\.pkg-cache)
  3. Run npx pkg --targets node14-win-x64 --output ./bin/test index.js (or something like that)
  4. It'll give the error message
github-actions[bot] commented 1 year ago

This issue is stale because it has been open 90 days with no activity. Remove the stale label or comment or this will be closed in 5 days. To ignore this issue entirely you can add the no-stale label

github-actions[bot] commented 1 year ago

This issue is now closed due to inactivity, you can of course reopen or reference this issue if you see fit.

ninjaboy commented 1 year ago

Still reproduces for me on windows despite environment variable being set, how can I reopen this?