yao-pkg / pkg-binaries

Collection of pkg nodejs binaries that are not supported by pkg
MIT License
89 stars 23 forks source link

Does this work with latest pkg? #22

Closed tmigone closed 1 year ago

tmigone commented 3 years ago

Using pkg 5.3.1 which uses pkg-fetch 3.2.2, downloaded binary for arm6, moved it into the cache folder but pkg still tries to build from source.

root@1611399:/usr/src# ls -al ~/.pkg-cache/v3.2/
total 92800
drwxr-xr-x 2 root root     4096 Aug 24 14:56 .
drwxr-xr-x 3 root root     4096 Aug 24 14:51 ..
-rwxr-xr-x 1 root root 28755972 Aug 24 14:56 fetched-v12.22.2-linuxstatic-armv7
-rwxr-xr-x 1 root root 66259348 Aug 24 14:52 fetched-v14.0.0-linux-armv6
geeklisted commented 2 years ago

Probably too late for you to care, but if you check .pkg-cache after it tries to download (and fails) the pre-built binary, check which version has .downloading in the filename and take note. Remove the file. Then, take the binary you do have and rename it to that copied value (and remove .downloading). Run pkg again and it should use the fetched version.

I believe the issue is due to 'pkg' checking for the very latest version of the node distro you want to use.

sinnrrr commented 2 years ago

@geeklisted in my case it just deletes the binary I've pasted and tries to build from source from the logs:

> pkg@5.7.0
> Fetching base Node.js binaries to PKG_CACHE_PATH
> Binary hash does NOT match. Re-fetching...
  fetched-v12.22.11-linux-armv7       [                    ] 0%

we can see, that it verifies checksum and it fails

robertsLando commented 2 years ago

@sinnrrr Latest version of pkg-fetch also does checksum checks, I suggest to use an old pkg version instead or to patch the code to skip checksum checks.

https://github.com/vercel/pkg-fetch/blob/main/lib/expected.ts#L1

Patch lines: https://github.com/vercel/pkg-fetch/blob/main/lib/index.ts#L121 https://github.com/vercel/pkg-fetch/blob/main/lib/index.ts#L143

Just remove the checks in this two lines and it should work

robertsLando commented 1 year ago

Now it works