JamieMason / JamieMason/shrinkpack

A package+version tarball can be insufficient if platform libraries are needed

Open
#98 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
800
Forks
27
PR merge metrics
No merged PRs in 30d

Description

## Some NPM packages depend on platform libs during installation

Case in point is the [sharp](https://github.com/lovell/sharp) package, which requires github.com/.../libvips-8.12.2-linux-x64.tar.br during installation. Using shrinkpack with sharp breaks during offline installs as follows:

```
$ rm -rf ~/.npm/ # purge NPM cache or run in a clean CI environment
$ npm ci --offline
npm ERR! code 1
npm ERR! path /tmp/bar/node_modules/sharp
npm ERR! command failed
npm ERR! command sh -c (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm ERR! sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.12.2/libvips-8.12.2-linux-x64.tar.br
npm ERR! sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
npm ERR! sharp: Installation error: getaddrinfo EAI_AGAIN github.com
```

The issue is reported here: [Unconditional Download during install breaks shrinkpack - sharp#3737](https://github.com/lovell/sharp/issues/3737)

## Suggested Solution

It is not clear to me how the needed libvips-8.12.2-linux-x64 could end up in the prepared node_shrinkpack/sharp-0.30.7.tar file, i.e. which project would have to be adjusted, but that would be required in order for `npm ci --offline` to work.

Contributor guide

No contributing guide indexed for this repository

Research direction

Reproduce the failure with a clean npm cache and `npm ci --offline`, focusing on the sharp install command and its libvips download. Trace how shrinkpack creates `node_shrinkpack/sharp-0.30.7.tar` and determine whether the platform library can be included there or must be handled elsewhere. Done means the sharp dependency installs successfully without network access.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, typescript
Domain
build-system, cli
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.