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.

AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value: (0, assert_1.default)(!this.bar)

See original GitHub issue

What version of pkg are you using?

5.6.0

What version of Node.js are you using?

16.13.2

What operating system are you using?

Windows 10

What CPU architecture are you using?

x86_64

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

node14-win-arm64

Describe the Bug

The stacktrace show that i can’t generate a bin file because it shows that have a syntax error in the file lib-es5 into the folder pkg-fetch inside the node_modules globally.

Here’s the stacktrace:

pkg@5.6.0

Fetching base Node.js binaries to PKG_CACHE_PATH fetched-v14.19.1-win-arm64 [ ] 0%> Not found in remote cache: {“tag”:“v3.3”,“name”:“node-v14.19.1-win-arm64”} Building base binary from source: built-v14.19.1-win-arm64 Fetching Node.js source archive from nodejs.org… Error! AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

(0, assert_1.default)(!this.bar)

at Log.enableProgress (C:\Users\leolu\AppData\Roaming\npm\node_modules\pkg\node_modules\pkg-fetch\lib-es5\log.js:64:30)
at C:\Users\leolu\AppData\Roaming\npm\node_modules\pkg\node_modules\pkg-fetch\lib-es5\utils.js:58:31
at step (C:\Users\leolu\AppData\Roaming\npm\node_modules\pkg\node_modules\pkg-fetch\lib-es5\utils.js:33:23)
at Object.next (C:\Users\leolu\AppData\Roaming\npm\node_modules\pkg\node_modules\pkg-fetch\lib-es5\utils.js:14:53)
at C:\Users\leolu\AppData\Roaming\npm\node_modules\pkg\node_modules\pkg-fetch\lib-es5\utils.js:8:71
at new Promise (<anonymous>)
at __awaiter (C:\Users\leolu\AppData\Roaming\npm\node_modules\pkg\node_modules\pkg-fetch\lib-es5\utils.js:4:12)
at downloadUrl (C:\Users\leolu\AppData\Roaming\npm\node_modules\pkg\node_modules\pkg-fetch\lib-es5\utils.js:53:12)
at C:\Users\leolu\AppData\Roaming\npm\node_modules\pkg\node_modules\pkg-fetch\lib-es5\build.js:140:66
at step (C:\Users\leolu\AppData\Roaming\npm\node_modules\pkg\node_modules\pkg-fetch\lib-es5\build.js:44:23)

Expected Behavior

Generate the executable file in the root directory

To Reproduce

pkg -t node14-win-arm64 dist/src/server.js

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:12

github_iconTop GitHub Comments

3reactions
aviTwitocommented, Sep 10, 2022

Solved it by using this explanation

1reaction
ohhoney1commented, Sep 5, 2022

try download it by yourself,in https://github.com/vercel/pkg-fetch/releases, and rename ‘node14-win-arm64’ to ‘fetched-v14.19.1-win-arm64’.

Can you share more info? I got the same problem. I tried downloaing node-v16.16.0-win-x64 and ran pkg -t fetched-v16.15.0-win-x64 main.js

output:

> pkg@5.8.0
> Error! Unknown token 'fetched' in 'fetched-v16.15.0-win-x64'

after downloaded and renamed, have a try: pkg -t node-v16.16.0-win-x64 main.js

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.js assert() Function - GeeksforGeeks
Error: AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value: assert(0) at Object.
Read more >
Mastering Node.js - Second Edition [PDF] | Online Book Share
Mastering Node.js. Second Edition Build robust and scalable real-time server-side web applications efficiently
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