vercel / pkg

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

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

Closed ninjaboy closed 11 months ago

ninjaboy commented 1 year ago

What version of pkg are you using?

^5.8.0

What version of Node.js are you using?

18

What operating system are you using?

windows

What CPU architecture are you using?

x64

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

node18-win-x64

Describe the Bug

Trying to build a package on windows CI machine without the external access to the internet:

  1. Created a local folder with

    ->  Directory of D:\full\out\project\pkg-fetch   -> 
    -> 01/31/1985  05:00 PM    <DIR>          .
    -> 01/31/1985  05:00 PM    <DIR>          ..
    -> 01/31/1985  05:00 PM    <DIR>          v3.4
    ->                0 File(s)              0 bytes
    -> 
    ->  Directory of D:\full\out\project\pkg-fetch\v3.4
    -> 
    -> 01/31/1985  05:00 PM    <DIR>          .
    -> 01/31/1985  05:00 PM    <DIR>          ..
    -> 01/31/1985  05:00 PM        46,205,192 fetched-v18.5.0-linux-x64
    -> 01/31/1985  05:00 PM        46,146,256 fetched-v18.5.0-macos-arm64
    -> 01/31/1985  05:00 PM        51,192,112 fetched-v18.5.0-macos-x64
    -> 01/31/1985  05:00 PM        37,574,656 fetched-v18.5.0-win-x64
    ->                4 File(s)    181,118,216 bytes
    -> 
    ->      Total Files Listed:
    ->                4 File(s)    181,118,216 bytes
    ->                5 Dir(s)  522,294,935,552 bytes free
    1. In the build cmd script do:
    set PKG_CACHE_PATH=D:\full\out\project\pkg-fetch &&  yarn pkg dist\index.js -t node18-win-x64 -c package.json --debug
    1. Given that PKG_CACHE_PATH is set and has v3.4 folder in it - I would assume the build should not be happening?

    Actual: CI machine tries to perform external www fetch:

    
    -> > pkg@5.8.1
    -> > Fetching base Node.js binaries to PKG_CACHE_PATH
    -> > Not found in remote cache:
    ->   {"tag":"v3.4","name":"node-v18.5.0-win-x64"}
    -> > Building base binary from source:
    ->   built-v18.5.0-win-x64
    -> > 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)
    ->  ....


### Expected Behavior

PKG should use prefetched binaries as per PKG_CACHE_PATH

### To Reproduce

   set PKG_CACHE_PATH=D:\full\out\project\pkg-fetch &&  yarn pkg dist\index.js -t node18-win-x64 -c package.json --debug
github-actions[bot] commented 11 months 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 11 months ago

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