Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install failed with 'sharp_local_prebuilds' #3154

Closed
1 task done
juliusdev opened this issue Mar 22, 2022 · 9 comments
Closed
1 task done

Install failed with 'sharp_local_prebuilds' #3154

juliusdev opened this issue Mar 22, 2022 · 9 comments

Comments

@juliusdev
Copy link

Hi,

I have an issue with the sharp installation, behind a http proxy which filter access to Github.
According the doc, the fallback is to set the 'sharp_local_prebuilds' npm config or the 'npm_config_sharp_local_prebuilds' env variable before install.

Here my .npmrc file content :
sharp_local_prebuilds=/mnt/d/Dev/Projects/testsharp/libvips-8.12.2-linux-x64.tar.br

I checked the npm config 'sharp_local_prebuilds'

npm config get sharp_local_prebuilds
/mnt/d/Dev/Projects/testsharp/libvips-8.12.2-linux-x64.tar.br

Here my env var :

 echo $npm_config_sharp_local_prebuild
/mnt/d/Dev/Projects/testsharp/libvips-8.12.2-linux-x64.tar.br

Now when I trying to install sharp with npm, the script try again to download the lib from github repository and fail.

Possible install-time or require-time problem

  • [x ] I have read the documentation relating to installation.
  • [x ] I have ensured that the architecture and platform of Node.js used for npm install is the same as the architecture and platform of Node.js used at runtime.

Are you using the latest version of sharp?

  • I am using the latest version of sharp as reported by npm view sharp dist-tags.latest.

If you cannot confirm this, please upgrade to the latest version and try again before opening an issue.

If you are using another package which depends on a version of sharp that is not the latest, please open an issue against that package instead.

Is this a problem with filesystem permissions?

If you are using npm v6 or earlier and installing as a root or sudo user, have you tried with the npm install --unsafe-perm flag?

If you are using npm v7 or later, does the user running npm install own the directory it is run in?

If you are using the ignore-scripts feature of npm, have you tried with the npm install --ignore-scripts=false flag?

What is the complete output of running npm install --verbose sharp?

npm verb enoent
npm WARN testsharp No description
npm WARN testsharp No repository field.
npm WARN testsharp No README data
npm WARN testsharp No license field.

npm verb stack Error: sharp@0.30.3 install: (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm verb stack Exit status 1
npm verb stack at EventEmitter. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16)
npm verb stack at EventEmitter.emit (events.js:400:28)
npm verb stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
npm verb stack at ChildProcess.emit (events.js:400:28)
npm verb stack at maybeClose (internal/child_process.js:1058:16)
npm verb stack at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5)
npm verb pkgid sharp@0.30.3
npm verb cwd /mnt/d/Dev/Projects/testsharp
npm verb Linux 5.10.16.3-microsoft-standard-WSL2
npm verb argv "/usr/bin/node" "/usr/bin/npm" "i" "--verbose" "sharp"
npm verb node v14.19.0
npm verb npm v6.14.16
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.30.3 install: (node install/libvips && node install/dll-copy && prebuild-install) || (node install/can-compile && node-gyp rebuild && node install/dll-copy)
npm ERR! Exit status 1

What is the output of running npx envinfo --binaries --system --npmPackages=sharp --npmGlobalPackages=sharp?

System: OS: Linux 5.10 Ubuntu 20.04.3 LTS (Focal Fossa) CPU: (4) x64 Intel(R) Core(TM) i3-8100 CPU @ 3.60GHz Memory: 10.07 GB / 12.38 GB Container: Yes Shell: 5.0.17 - /bin/bash Binaries: Node: 14.19.0 - /usr/bin/node Yarn: 1.22.17 - /mnt/c/Users/5120/AppData/Roaming/npm/yarn npm: 6.14.16 - /usr/bin/npm
@lovell
Copy link
Owner

lovell commented Mar 22, 2022

Hi, the sharp_local_prebuilds environment variable refers to the prebuilt binaries for sharp, not libvips.

https://sharp.pixelplumbing.com/install#custom-prebuilt-binaries

https://github.com/lovell/sharp/releases/tag/v0.30.3

https://github.com/prebuild/prebuild-install#local-prebuilds

@juliusdev
Copy link
Author

It's my mistake 🤐

I uploaded the libvips and sharp binaries on the company Nexus repository and set the following variables in my .npmrc

sharp_libvips_binary_host=https://nexus.xxxx.x/repository/raw-repo/libvips
sharp_binary_host=https://nexus.xxxxx.x/repository/raw-repo/sharp

Thanks ! it works fine 👍

@lovell lovell closed this as completed Mar 22, 2022
@dirjk
Copy link

dirjk commented Mar 25, 2022

@lovell I am also behind a proxy and unable to download the libvips binaries from github. However, I do not have a server that I can upload them to as a host, like @juliusdev did.

npm_config_sharp_libvips_binary_host does not work and neither does sharp_libvips_binary_host which I assume is because, as the documentation says, those are for custom URLs and require a server.

Are there variables that can be set to have the libvips binaries loaded from a local file path? I am hoping there are libvips equivalents of sharp_local_prebuilds and npm_config_sharp_local_prebuilds.

thank you!

@lovell
Copy link
Owner

lovell commented Mar 26, 2022

@dirjk sharp will always looks for a globally-installed libvips at npm install time, so for environments where you do not have network access at install time, you'll need to arrange for libvips to be installed in whatever manner you use for other OS-level dependencies.

@ricovitch
Copy link

ricovitch commented Mar 28, 2022

I'm also stucked on installing sharp behind a proxy on MacOS.

I followed this steps

  • libvips installed globally with home brew libvips
  • sharp binaries downloaded from github release and served locally through npmrc config sharp_local_prebuilds

My .npmrc file looks like this :

sharp_local_prebuilds=~/Dev/tools/libvips/sharp-v0.30.3-napi-v5-darwin-x64.tar.gz

npm install fail with this error

npm ERR! sharp: Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.12.2/libvips-8.12.2-darwin-x64.tar.br
npm ERR! sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
npm ERR! sharp: Installation error: read ECONNRESET

@lovell
Copy link
Owner

lovell commented Mar 28, 2022

@ricovitch Please open a new installation issue and answer all of the questions if you still require help.

@ricovitch
Copy link

Ok sure I'll do that thank you for the fast answer.

@jebolivarb
Copy link

jebolivarb commented Mar 6, 2024

Hello, I was checking it and it was not possible to find a solution with the indicated steps. I created the .npmrc file in my project with the requested content and the error still persists. The truth is, I have done everything and it has not been possible for me to find a solution.

sharp_local_prebuilds= C:\Users\Jehico.Bolívar\base-baileys-memory\libvips-8.12.2-win32-x64.tar.br
sharp_libvips_binary_host=https://github.com/lovell/sharp-libvips/releases/download/v8.12.2/libvips-8.12.2-win32-x6
sharp_binary_host=sharp_binary_host=https://github.com/lovell/sharp/releases/tag/v0.33.2

machine specifications
Windows 10 Pro - 64 bits

npm ERR! code 1
npm ERR! path C:\Users\Jehico.Bolívar\base-baileys-memory\node_modules\sharp
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /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-win32-x6/v8.12.2/libvips-8.12.2-win32-x64.tar.br
npm ERR! sharp: Please see https://sharp.pixelplumbing.com/install for required dependencies
npm ERR! sharp: Installation error: self-signed certificate in certificate chain

npm ERR! A complete log of this run can be found in: C:\Users\Jehico.Bolívar\AppData\Local\npm-cache_logs\2024-03-06T20_15_26_970Z-debug-0.log

@lovell
Copy link
Owner

lovell commented Mar 6, 2024

For anyone coming here, please upgrade to the latest version of sharp, currently v0.33.2, and this entire class of problem goes away (see #3750 for context).

Repository owner locked and limited conversation to collaborators Mar 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants