AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value: (0, assert_1.default)(!this.bar)
See original GitHub issueWhat 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:
- Created a year ago
- Comments:12
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Solved it by using this explanation
after downloaded and renamed, have a try:
pkg -t node-v16.16.0-win-x64 main.js