How to fix “ERR! sharp Prebuilt libvips 8.10.5 binaries are not yet available for darwin-arm64v8”

Joseph Pereniguez
2 min readMar 9, 2021

--

ERR! sharp Prebuilt libvips 8.10.5 binaries are not yet available for darwin-arm64v8

Maybe you already get this error running npm install in your project directory with your new MacBook Pro.
I personally got this error while developing a NodeJS / React web-app on my new MacBook Pro with the new M1 ship few days ago… you can guess how anxious I was at the time. I’ll try to avoid that moment for you.

What happened?

The lib libvips used in the Sharp package that is required to convert large images into common format couldn’t be compiled under darwin-arm64v8 architecture.

Here are steps to bypass this issue:

Get the right npm version through nvm

If Npm has not been installed through nvm run these command lines and install a version compatible with Apple Silicon M1 devices (here I took the latest version).

So first, get nvm by running the following command

$ curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | bash

Then get the right version of npm using nvm by running the following commands

$ brew uninstall node
$ nvm install v15.6.0
$ nvm use v15.6.0
$ nvm alias default v15.6.0

Building libvips from a source tarball

Download vips-x.y.z.tar.gz from the Download area, then run these commands to install required packages for vips.

$ tar xf vips-x.y.z.tar.gz
$ brew install pkg-config glib zlib
$ brew install libjpeg-turbo libpng webp
$ cd vips-x.y.z
$ PKG_CONFIG_PATH=/opt/homebrew/Cellar/zlib/1.2.11/lib/pkgconfig ./configure

Finally install vips itself by running the following commands

$ make
$ sudo make install

Now you should be able to install your npm packages without problems

Post-mortem

I got an other issue while running npm start caused by react-refresh-webpack-plugin.

←- JS stacktrace — -> FATAL ERROR: wasm code commit Allocation failed — process out of memory

It can be fix by running the project like this or by installing a node version later than 15.3.0.

ENV FAST_REFRESH=false npm start 

Sources

--

--