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

Can't compile under Apple Silicon M1 arm64 #2460

Closed
gpetrov opened this issue Nov 25, 2020 · 82 comments
Closed

Can't compile under Apple Silicon M1 arm64 #2460

gpetrov opened this issue Nov 25, 2020 · 82 comments

Comments

@gpetrov
Copy link

gpetrov commented Nov 25, 2020

Did you see the documentation relating to installation?

  • yes

Have you ensured 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?

  • yes

Are you using the latest version? Is the version currently in use as reported by npm ls sharp the same as the latest version as reported by npm view sharp dist-tags.latest?

  • yes

What is the complete output of running npm install --verbose sharp? Have you checked this output for useful error messages?

> sharp@0.26.3 install /..../node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.10.0/libvips-8.10.0-darwin-arm64v8.tar.br
ERR! sharp Prebuilt libvips 8.10.0 binaries are not yet available for darwin-arm64v8
info sharp Attempting to build from source via node-gyp but this may fail due to the above error
info sharp Please see https://sharp.pixelplumbing.com/install for required dependencies
gyp info it worked if it ends with ok
....
 -gdwarf-2 -mmacosx-version-min=11 -arch arm64 -Wall -Wendif-labels -W -Wno-unused-parameter -std=c++14 -stdlib=libc++ -fexceptions -Wall -O3 -std=c++14 -stdlib=libc++ -MMD -MF ./Release/.deps/Release/obj.target/sharp/src/common.o.d.raw   -c -o Release/obj.target/sharp/src/common.o ../src/common.cc
../src/common.cc:24:10: fatal error: 'vips/vips8' file not found
#include <vips/vips8>
         ^~~~~~~~~~~~
1 error generated.
make: *** [Release/obj.target/sharp/src/common.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/nw-gyp/lib/build.js:261:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 20.1.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/bin/nw-gyp" "rebuild"

gyp ERR! node -v v14.15.1
gyp ERR! nw-gyp -v v3.6.2
gyp ERR! not ok 

Seems somehow libvips can't be compiled from source

Any ideas?

@lovell
Copy link
Owner

lovell commented Nov 25, 2020

info sharp Downloading https://github.com/lovell/sharp-libvips/releases/download/v8.10.0/libvips-8.10.0-darwin-arm64v8.tar.br
ERR! sharp Prebuilt libvips 8.10.0 binaries are not yet available for darwin-arm64v8
info sharp Attempting to build from source via node-gyp but this may fail due to the above error

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

You'll need to compile libvips from source and install it globally first.

https://sharp.pixelplumbing.com/install#custom-libvips

@gpetrov
Copy link
Author

gpetrov commented Nov 25, 2020

I was already using --build-from-source all the time and even tried SHARP_IGNORE_GLOBAL_LIBVIPS
but with the same results unfortunately.

Should I try to compile libvips completely independent from npm as explained here?
https://libvips.github.io/libvips/install.html#building-libvips-from-a-source-tarball

I thought npm install --build-from-source should take care of that ...

@lovell
Copy link
Owner

lovell commented Nov 25, 2020

Building libvips from source is independent of building sharp from source, so yes, you'll need to follow the libvips-provided instructions.

We won't be able to provide any prebuilt binaries for Apple Silicon until a CI provider makes ARM64 macOS hardware available for free to open source.

@gpetrov
Copy link
Author

gpetrov commented Nov 25, 2020

Unfortunately homebrew is not yet fully compatible with apple silicon as of Homebrew/brew#7857
so commands like configure and autoconf aren't there yet - which makes difficult to compile libvips

if you have other ideas - I will be glad to try them out on the M1. I was able to compile many other node modules without any problem on Apple Silicon arm64, it's just the libvips that gives me an issue and stops me from completing the last step with the great node module sharp.

Can I just copy the source from libvips so it gets picket up by the npm install --build-from-source ?
As this is just the whole error:

../src/common.cc:24:10: fatal error: 'vips/vips8' file not found

@gpetrov
Copy link
Author

gpetrov commented Nov 25, 2020

Actually I got bit further in compiling libvips under M1 arm64 but unfortunately got stuck in compiling dependencies like libglib2 which are totally unaware of the Mac arm64 and try to use Windows AARM64

So seems there is unfortunately a long way to go to make all this happen. As the guys from homebrew discovered and are working hard to get it all right.

@gpetrov
Copy link
Author

gpetrov commented Nov 29, 2020

Well I finally managed to compile libvips with homebrew under apple arm64, but had to compile it without fftw, libmatio, librsvg and poppler

fftw was requiring gcc as well libmatio, while librsvg needed rust which is not ready yet.
Poppler needed Qt which brought the whole chrome with it, obviously not needed.

trying to build everything statically now, but without luck due to the mentioned bug.

are the prebuild binaries all build statically? Ideally we would like to add a prebuild binary.

@lovell
Copy link
Owner

lovell commented Nov 30, 2020

The prebuilt binaries for libvips and its (selected) dependencies as provided by sharp are statically linked into a single shared library that can then be dynamically linked to sharp itself. These are created by the scripts in https://github.com/lovell/sharp-libvips/

@mogharsallah
Copy link

mogharsallah commented Dec 2, 2020

I'm interested in this topic as well, did anyone figure a way to get sharp running under Apple silicon m1?

@kenips
Copy link

kenips commented Dec 4, 2020

Confirmed from #2467 that this is a non-issue once you have libvips install globally. I wasn't able to install it via brew, but downloaded the tarball and manually compiled fine, with the caveat that I had to manually specify zlib's location: PKG_CONFIG_PATH=/opt/homebrew/Cellar/zlib/1.2.11/lib/pkgconfig ./configure. Once installed globally sharp works fine.

@gpetrov
Copy link
Author

gpetrov commented Dec 4, 2020

@kenips - great to hear you manage to compile it globally! I managed only to compile it with brew, but had to leave a lot of dependencies away. Did you had to leave our some dependencies as well?

Do you have more detailed procedure for the global install? Did you install additional building tools first on a virgin M1, like autoconf, confure and pkgconfig?

@mogharsallah
Copy link

mogharsallah commented Dec 5, 2020

I managed to run sharp thanks to @kenips comment
Here's what I have done:

  1. Start with installing Mac ports. You will use ports to install libvips dependencies (follow next step)

  2. Install these ports: pkgconfig and glib2. Use this command to install ports: $ sudo port install [port-name]

  3. Now depending on the formats you'll be handling, you'll have to install the library for each format. Have look at the libvips dependency list and find them on Mac ports.
    In my case, jpg and png formats are enough, so I installed libjpeg-turbo and libpng

  4. Once you've installed the libraries, you're ready to install libvips.

    • Download and unpack the latest libvips release; I used this release.
    • Inside the unpacked folder, run $ ./configure.
    • Then run $ make followed by $ sudo make install

    This should install vips globally. Verify by running: $ which vips

  5. When libvips is globally installed, sharp will use the global version. So clean up your node_modules folder and do a fresh install and you're ready to go 👍

@kenips
Copy link

kenips commented Dec 5, 2020

@gpetrov yes my procedure is very similar to @medhoover, however using homebrew:

  1. Install homebrew arm. I used the steps here.
  2. Install pkg-config, zlib normally with brew install
  3. Same as above, install any libraries that you need for each image format. I have jpeg, libpng, libtiff, webp installed.
  4. Exactly same as @medhoover's steps above, except for configure I had to specify the zlib path with PKG_CONFIG_PATH=/opt/homebrew/Cellar/zlib/1.2.11/lib/pkgconfig ./configure.

I have installed a few packages prior to installing libvips, so there might be additional packages that I've missed for a mint install, so YMMV :).

@abarisain
Copy link

abarisain commented Dec 7, 2020

Those steps worked for me, thanks! Please note that I also needed to set the PKG_CONFIG_PATH env var when installing node modules.

@shahzore-qureshi
Copy link

shahzore-qureshi commented Dec 7, 2020

Thank you @medhoover and @kenips as well as @gpetrov for working on this. Just got myself a Mac Mini M1 and am struggling to get a project running.

Just wanted to add to @medhoover's comment: the port name of pkg-config is pkgconfig. The port install command should be sudo port install pkgconfig.

@junkboy0315
Copy link

I was able to get it to work in the following ways with Node.js 15.3.0.
Thanks @medhoover @kenips !

brew install pkg-config glib zlib
brew install libjpeg-turbo libpng webp

# in the libvips source folder
PKG_CONFIG_PATH=/opt/homebrew/Cellar/zlib/1.2.11/lib/pkgconfig ./configure
make
sudo make install

@natew
Copy link

natew commented Dec 24, 2020

I ended up having to run it with to avoid some weird imagemagick/poppler issues (even when installed for arm):

PKG_CONFIG_PATH=/opt/homebrew/Cellar/zlib/1.2.11/lib/pkgconfig ./configure --without-magick --without-poppler

If you're running into issues with x86 libraries, be sure to check your Makefile after you run configure and see if anything is coming from the old homebrew (/usr/local/lib for me). Then install it on arm and re-run the above configure command.

Edit: actually this one failed too, I'm getting this now, even though the directory exists:

../libtool: line 1733: cd: .libs/libvips.lax/libresample.a: No such file or directory

Edit 2: Ended up being because I had a space in the libvips folder name due to downloading two of the same version 😞

Now at:

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ranlib: archive member: .libs/libcolour.a(profile_load.o) cputype (16777223) does not match previous archive members cputype (16777228) (all members must match)

Any reason I've run into so many different issues? Trying a fresh download of libvips to see if perhaps I just messed up something, otherwise will continue mucking around.

Edit:

Deleted and re-downloaded libvips, its saying during configure and then failing now with mismatch arch. Somehow regressed on this..

checking build system type... x86_64-apple-darwin20.2.0

@gpetrov
Copy link
Author

gpetrov commented Dec 27, 2020

🎉 I'm happy to report that thanks to the huge effort of the homebrew team and specially @fxcoudert, libvips can be fully installed on Apple Silicon M1 natively with all its dependencies!

Also for the most of the dependencies prebuild binaries "bottles" are available so installation goes really fast

brew info vips

vips: stable 8.10.5
Image processing library
https://github.com/libvips/libvips
/opt/homebrew/Cellar/vips/8.10.5 (167 files, 14.0MB) *
  Built from source on 2020-12-27 at 16:44:20
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/vips.rb
License: LGPL-2.1-or-later
==> Dependencies
Build: pkg-config ✔
Required: cfitsio ✔, fftw ✔, fontconfig ✔, gettext ✔, giflib ✔, glib ✔, imagemagick ✔, libexif ✔, libgsf ✔, libheif ✔, libimagequant ✔, libmatio ✔, libpng ✔, librsvg ✔, libspng ✔, libtiff ✔, little-cms2 ✔, mozjpeg ✔, openexr ✔, openslide ✔, orc ✔, pango ✔, poppler ✔, webp ✔
==> Analytics
install: 4,198 (30 days), 14,926 (90 days), 42,146 (365 days)
install-on-request: 3,633 (30 days), 12,169 (90 days), 32,332 (365 days)
build-error: 0 (30 days)

brew reinstall vips

==> Downloading https://github.com/libvips/libvips/releases/download/v8.10.5/vips-8.10.5.tar.gz
Already downloaded: /Users/george/Library/Caches/Homebrew/downloads/e8752c98d6977d23909b94c1d3ee31e2c21afda72fa95eeb140bbbbde0add7c8--vips-8.10.5.tar.gz
==> Reinstalling vips 
==> ./configure --prefix=/opt/homebrew/Cellar/vips/8.10.5 --with-magick
==> make install
🍺  /opt/homebrew/Cellar/vips/8.10.5: 167 files, 14.0MB, built in 58 seconds

brew config

HOMEBREW_VERSION: 2.7.0
ORIGIN: https://github.com/Homebrew/brew
HEAD: 993bf95877143afe1cede022083499e0b4fe336c
Last commit: 6 days ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 27df7ec4599f2aa202586e4d7950afa66e820293
Core tap last commit: 2 hours ago
Core tap branch: master
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 12.0 build 1200
Git: 2.24.3 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.1-arm64
CLT: 12.3.0.0.1.1607026830
Xcode: 12.3
Rosetta 2: false

the same is valid for node and the sharp library now - they can run nicely native on M1 now!

@cooknpop
Copy link

I had a similar issue with incompatibility with M1 chips at node installation time (none of the suggestions worked for me, not even reinstalling vips with 'apparently' full compatibility with M1):

Something went wrong installing the "sharp" module
dlopen(/Users/.../node_modules/sharp/build/Release/sharp.node, 1): no suitable image found.  Did find:
	/Users/.../node_modules/sharp/build/Release/sharp.node: mach-o, but wrong architecture
	/Users/.../node_modules/sharp/build/Release/sharp.node: mach-o, but wrong architecture

My environment is the following:

- node v15.5.1
- "sharp": "^0.27.0" (package.json)
brew config                                                                                                                             miguelocana@MBP-de-Miguel
HOMEBREW_VERSION: 2.7.2-76-gd75e9c9
ORIGIN: https://github.com/Homebrew/brew
HEAD: d75e9c99b34bc55e89a6ea0d3520273451e06131
Last commit: 10 hours ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: 78db076bcc232c93d3df78209e72e1d6b9a358b1
Core tap last commit: 80 minutes ago
Core tap branch: master
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 8
Homebrew Ruby: 2.6.3 => /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby
CPU: octa-core 64-bit arm_firestorm_icestorm
Clang: 12.0 build 1200
Git: 2.24.3 => /Library/Developer/CommandLineTools/usr/bin/git
Curl: 7.64.1 => /usr/bin/curl
macOS: 11.1-arm64
CLT: 12.3.0.0.1.1607026830
Xcode: 12.3
Rosetta 2: false

Any idea?

@gpetrov
Copy link
Author

gpetrov commented Jan 10, 2021

Your node_modules contain an old Mac x86 binary. You can delete them and do a fresh npm install

@iksent
Copy link

iksent commented Jan 11, 2021

I have the same problem as @cooknpop: deleting and reinstalling node_modules didn't work (not with npm, nor with yarn)

All I've done is:

  • brew install vips
  • Deleted node_modules folder
  • Run yarn install / npm install
  • npm rebuild also didn't work

I see this while yarn install:

info sharp Detected globally-installed libvips v8.10.5
info sharp Building from source via node-gyp
  CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
...

But then I got:

Something went wrong installing the "sharp" module
dlopen(/Users/user/develop/project/backend/node_modules/strapi-plugin-upload/node_modules/sharp/build/Release/sharp.node, 1): no suitable image found.  Did find:
        /Users/user/develop/project/backend/node_modules/strapi-plugin-upload/node_modules/sharp/build/Release/sharp.node: mach-o, but wrong architecture
        /Users/user/develop/project/backend/node_modules/strapi-plugin-upload/node_modules/sharp/build/Release/sharp.node: mach-o, but wrong architecture

@abarisain
Copy link

Check ~/.npm

There's probably a sharp directory there. Try deleting it

@frytg
Copy link

frytg commented Jan 11, 2021

It might also help to remove any package-lock or yarn.lock files

@iksent
Copy link

iksent commented Jan 11, 2021

@abarisain, no such folder
@frytg, failure also

npm/yarn cache clean didn't help
npm install --ignore-scripts=false --verbos ends with ok

@cooknpop
Copy link

@iksent
I succeed to solve the issue with mach-o, but wrong architecture (even if not the cleanest solution).
As my mac was new, I did a fresh clean-up of all my files and installed everything from scratch (mainly homebrew, nvm/node) making sure the architecture chosen was arm and not x86.
Probably the issue was that at the beginning I downloaded node directly from the web, and this version is in x86 format, so the conflicts raised. I guess there is a simpler solution (I didn't have the chance to check sharp folder from ./npm as I already had started the clean-up process at this point, another nightmare BTW).

Said that, my suggestion:
Install node directly with nvm from scratch in arm version and not from the web, with no other nodejs previously installed in the computer.

I hope it will help.

lovell added a commit that referenced this issue Feb 22, 2021
- For Rosetta x64, prevent use of global ARM64 libvips
- For ARM64, improve error message when global libvips not found
@lovell
Copy link
Owner

lovell commented Feb 22, 2021

Commit 4264c05, part of the forthcoming sharp v0.27.2, should improve the experience for those using Apple M1 devices.

  • For Rosetta x64, it prevents the use of a globally-installed ARM64 libvips as this conflict with the use of x64 Node.js
  • For ARM64, when a globally-installed libvips is not found, it will highlight the need to install via homebrew

From sharp v0.28.0 onwards, cross-compiled libvips binaries will be provided for darwin-arm64 - thank you @abarisain for helping with this.

As soon as GitHub Actions or a similar CI service makes the M1 freely available to open source projects then natively compiled and tested prebuilt darwin-arm64 binaries will also be provided for sharp.

@seloner
Copy link

seloner commented Feb 24, 2021

Commit 4264c05, part of the forthcoming sharp v0.27.2, should improve the experience for those using Apple M1 devices.

  • For Rosetta x64, it prevents the use of a globally-installed ARM64 libvips as this conflict with the use of x64 Node.js
  • For ARM64, when a globally-installed libvips is not found, it will highlight the need to install via homebrew

From sharp v0.28.0 onwards, cross-compiled libvips binaries will be provided for darwin-arm64 - thank you @abarisain for helping with this.

As soon as GitHub Actions or a similar CI service makes the M1 freely available to open source projects then natively compiled and tested prebuilt darwin-arm64 binaries will also be provided for sharp.

Strapi uses sharp as a dependency under the hood . How to force to use the latest version ? I tried using resolution

resolutions:{
"sharp":"0.27.2"
}

I think it worked if someone is having the same issue

@ghassanmas
Copy link

ghassanmas commented Mar 1, 2021

Hi everyone,
For people who still facing this issue, one alternative is use/install node using Rosetta mode.
First
1 - I uninstalled nvm, i.e. rm -rf $NVM_DIR ~/.npm ~/.bower
2- I followed the instruction in this article
Note: if you got an error while installing nvm from article, you can just use this command from the official nvm doc: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.2/install.sh | bash

@abarisain
Copy link

abarisain commented Mar 1, 2021

I'm trying hard to stay on topic, but please don't follow this article. The advice there is bad: there is no good reason to run the terminal itself under rosetta. Performance will suffer for no reason. Why would the terminal emulator itself, along with its rendering engine, need to run under rosetta? It does not.

f you really must use a rosetta'd shell, use something like "arch -x86_64 /bin/bash"
You don't need nvm to run under rosetta either (and actually it will not as it's just a bunch of architecture independent shell scripts): just keep your "native" install of it, it doesn't change anything to uninstall/reinstall it.

Using nvm to install node < 15 will result in x64 node being installed, and rosetta will automatically take over. Using nvm ,even in an arm64 shell, to install node 14 or lower will automatically install a rosetta node, usable from your native arm64 shell.
Only if you need a x64 node 15 should you force a x86_64 shell (not terminal app) to use nvm to install node 15.

Sharp 0.27.2 also nudges you toward the best solution, which is installing libvips natively: rosetta can't translate all of libvips and you will encounter crashes when processing some files. It will also handle skipping system libvips when running in rosetta, so installing vips using homebrew doesn't block you from falling back on rosetta node.

@seloner
Copy link

seloner commented Mar 1, 2021

How to install node 14 without nvm ?
My issue is that I am using a package with sharp as internal dependency and the version of sharp is lower that 0.27.2
Next js Image will replace sharp and in the next version of nextjs.

@ghassanmas
Copy link

@seloner just try to install node in the Rosetta mode following the official documentation.

@ghassanmas
Copy link

ghassanmas commented Mar 1, 2021

@abarisain
Thank you for your note.
I understand that its better to use native, please note that my proejct doesn't depend on sharp directly, I am using the gatsby-transformer-sharp which depends on sharp . Alsot note: I have tried many times by building a new gatsby site but unfortunately kept on getting the error (just as to differenetie if the cause is from my project configuration or not).
The thing is node15 is still not stable and add to that I don't need to run the project in a container/VM at least not at this time.

@abarisain
Copy link

abarisain commented Mar 1, 2021

I'm not saying to use native node, I'm saying to use rosetta'd node using other ways rather than running the whole terminal under rosetta, which will destroy its performance. arch is the magic command you're looking for, allowing to spawn processes for a different architecture (even shells!). Child processes will then inherit the architecture, if it is available, and swift if needed.

"nvm install 14" will install a x86_64 node, even on arm64. Only for node 15 you'd need some kind of workaround (like "arch -x86_64 /bin/bash -c nvm install 15")

Last time I get off topic, sorry.

@seloner
Copy link

seloner commented Mar 1, 2021

Using nvm you will only run node only under rosetta and not the whole terminal

@ghassanmas
Copy link

Sorry for getting off topic again!.
There are still issues when installing node < 15, on arm...
Please refer to this issue for example nvm-sh/nvm#2350

@lovell
Copy link
Owner

lovell commented Mar 2, 2021

Please subscribe to #2604 to track the provision of darwin-arm64v8 prebuilt binaries in the forthcoming v0.28.0 release.

I'll close this issue as it's drifting somewhat off-topic but has been valuable nonetheless, thank you all for your participation.

@tomavic
Copy link

tomavic commented Mar 21, 2021

I accidentally came to this problem as I am trying to install cordova-res globally using npm.
I tried some mentioned solutions up there and when I try to install it again npm i -g cordova-res I get the same error.

I am using mac M1 and node 14.x

Appreciate your help.

@lovell
Copy link
Owner

lovell commented Mar 29, 2021

sharp v0.28.0 is now available and provides prebuilt (cross-compiled) libvips binaries for Apple M1 (darwin-arm64v8) so you no longer need to install vips via Homebrew.

https://sharp.pixelplumbing.com/install#apple-m1

Xcode and Python are still required as sharp must be built from source. As soon as GitHub Actions or a similar CI service makes M1-based machines freely available to open source projects then natively compiled and tested prebuilt darwin-arm64 binaries will also be provided for sharp.

@tomavic
Copy link

tomavic commented Mar 29, 2021

What should we do? any direct advise?

@gpetrov
Copy link
Author

gpetrov commented Mar 29, 2021

As soon as GitHub Actions or a similar CI service makes M1-based machines freely available to open source projects then natively compiled and tested prebuilt darwin-arm64 binaries will also be provided for sharp.

you can build mac arm on intel, so infrastructure change is not really needed. Google Chromium describes it well: https://chromium.googlesource.com/chromium/src/+/master/docs/mac_arm64.md

@abarisain
Copy link

That's what has been done for libvips.

Cross compiling the node library looks way more difficult. It might not be, but I didn't manage to do it.

Missing those prebuilts isn't a big deal that said, you most likely rely on dev tools being installed for other stuff (like homebrew itself, or any node gyp module)

@ollyde
Copy link

ollyde commented Mar 31, 2021

I was able to get it to work in the following ways with Node.js 15.3.0.
Thanks @medhoover @kenips !

brew install pkg-config glib zlib
brew install libjpeg-turbo libpng webp

# in the libvips source folder
PKG_CONFIG_PATH=/opt/homebrew/Cellar/zlib/1.2.11/lib/pkgconfig ./configure
make
sudo make install

A bit lost here; do you mean the brew installation folder, or each and every node_modules directory? (If we have 30 could be boring haha)

@lovell
Copy link
Owner

lovell commented Mar 31, 2021

Please can everyone using Apple M1 devices upgrade to sharp v0.28.0, which removes the need to install/compile things via Homebrew.

Even better, please can you open PRs to update any downstream packages (such as cordova-res) that are still using older versions.

https://sharp.pixelplumbing.com/install#apple-m1

I'm going to lock this issue now. If you're still having problems, please open a new installation issue and answer all of the questions.

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

Successfully merging a pull request may close this issue.