sharp: Error: Something went wrong installing the "sharp" module (Apple M1 chip)

It looks like I can install sharp with ‘npm i’, but it shows errors during ‘gatsby develop’.

npm i

> sharp@0.27.2 install /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Detected globally-installed libvips v8.11.2
info sharp Building from source via node-gyp
  CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
  LIBTOOL-STATIC Release/nothing.a
warning: /Library/Developer/CommandLineTools/usr/bin/libtool: archive library: Release/nothing.a the table of contents is empty (no object file members in the library define global symbols)
  TOUCH Release/obj.target/libvips-cpp.stamp
  CXX(target) Release/obj.target/sharp/src/common.o
  CXX(target) Release/obj.target/sharp/src/metadata.o
  CXX(target) Release/obj.target/sharp/src/stats.o
  CXX(target) Release/obj.target/sharp/src/operations.o
  CXX(target) Release/obj.target/sharp/src/pipeline.o
  CXX(target) Release/obj.target/sharp/src/utilities.o
  CXX(target) Release/obj.target/sharp/src/sharp.o
  SOLINK_MODULE(target) Release/sharp.node
ld: warning: ignoring file /opt/homebrew/Cellar/vips/8.11.2/lib/libvips-cpp.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/Cellar/vips/8.11.2/lib/libvips.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/Cellar/glib/2.68.3/lib/libgobject-2.0.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/Cellar/glib/2.68.3/lib/libglib-2.0.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
ld: warning: ignoring file /opt/homebrew/opt/gettext/lib/libintl.dylib, building for macOS-x86_64 but attempting to link with file built for macOS-arm64
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN @typescript-eslint/eslint-plugin@2.34.0 requires a peer of eslint@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/parser@2.34.0 requires a peer of eslint@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app@5.2.1 requires a peer of eslint@6.x but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app@5.2.1 requires a peer of eslint-plugin-react-hooks@1.x || 2.x but none is installed. You must install peer dependencies yourself.
npm WARN eslint-loader@2.2.1 requires a peer of eslint@>=1.6.0 <7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN gatsby-plugin-sitemap@3.3.0 requires a peer of gatsby@^3.0.0-next.0 but none is installed. You must install peer dependencies yourself.
npm WARN slick-carousel@1.8.1 requires a peer of jquery@>=1.8.0 but none is installed. You must install peer dependencies yourself.
npm WARN ts-node@9.1.1 requires a peer of typescript@>=2.7 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.21.0 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.

added 5 packages from 73 contributors and audited 2629 packages in 594.485s

217 packages are looking for funding
  run `npm fund` for details

gatsby develop

warn Plugin gatsby-plugin-sitemap is not compatible with your gatsby version 2.32.13 - It requires gatsby@^3.0.0-next.0

 ERROR 

Error in "/Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby-transformer-sharp/gatsby-node.js":
Something went wrong installing the "sharp" module

Cannot find module '../build/Release/sharp.node'
Require stack:
- /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby-plugin-sharp/node_modules/sharp/lib/constructor.js
- /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby-plugin-sharp/node_modules/sharp/lib/index.js
- /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby-plugin-sharp/safe-sharp.js
- /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby-plugin-sharp/index.js
- /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby-transformer-sharp/customize-schema.js
- /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby-transformer-sharp/gatsby-node.js
- /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby/dist/bootstrap/resolve-module-exports.js
- /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby/dist/bootstrap/load-plugins/validate.js
- /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby/dist/bootstrap/load-plugins/load.js
- /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby/dist/bootstrap/load-plugins/index.js
- /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby/dist/services/initialize.js
- /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby/dist/services/index.js
- /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby/dist/state-machines/develop/services.js
- /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby/dist/state-machines/develop/index.js
- /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby/dist/commands/develop-process.js
- /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/.cache/tmp-39940-azClAAVaD94d

- Run "npm rebuild --verbose sharp" and look for errors
- Consult the installation documentation at https://sharp.pixelplumbing.com/install
- Search for this error at https://github.com/lovell/sharp/issues




  Error: Something went wrong installing the "sharp" module
  Cannot find module '../build/Release/sharp.node'
  Require stack:
  - /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby-plugin-sharp/node_modules/sharp/lib/constructor.js
  - /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby-plugin-sharp/node_modules/sharp/lib/index.js
  - /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby-plugin-sharp/safe-sharp.js
  - /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby-plugin-sharp/index.js
  - /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby-transformer-sharp/customize-schema.js
  - /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby-transformer-sharp/gatsby-node.js
  - /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby/dist/bootstrap/resolve-module-exports.js
  - /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby/dist/bootstrap/load-plugins/validate.js
  - /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby/dist/bootstrap/load-plugins/load.js
  - /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby/dist/bootstrap/load-plugins/index.js
  - /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby/dist/services/initialize.js
  - /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby/dist/services/index.js
  - /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby/dist/state-machines/develop/services.js
  - /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby/dist/state-machines/develop/index.js
  - /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby/dist/commands/develop-process.js
  - /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/.cache/tmp-39940-azClAAVaD94d
  - Run "npm rebuild --verbose sharp" and look for errors
  - Consult the installation documentation at https://sharp.pixelplumbing.com/install
  - Search for this error at https://github.com/lovell/sharp/issues
  
  - constructor.js:34 Object.<anonymous>
    [fit_gatsby]/[gatsby-plugin-sharp]/[sharp]/lib/constructor.js:34:9
  
  - v8-compile-cache.js:192 Module._compile
    [fit_gatsby]/[v8-compile-cache]/v8-compile-cache.js:192:30
  
  - loader.js:1157 Object.Module._extensions..js
    internal/modules/cjs/loader.js:1157:10
  
  - loader.js:985 Module.load
    internal/modules/cjs/loader.js:985:32
  
  - loader.js:878 Function.Module._load
    internal/modules/cjs/loader.js:878:14
  
  - loader.js:1025 Module.require
    internal/modules/cjs/loader.js:1025:19
  
  - v8-compile-cache.js:159 require
    [fit_gatsby]/[v8-compile-cache]/v8-compile-cache.js:159:20
  
  - index.js:3 Object.<anonymous>
    [fit_gatsby]/[gatsby-plugin-sharp]/[sharp]/lib/index.js:3:15
  
  - v8-compile-cache.js:192 Module._compile
    [fit_gatsby]/[v8-compile-cache]/v8-compile-cache.js:192:30
  
  - loader.js:1157 Object.Module._extensions..js
    internal/modules/cjs/loader.js:1157:10
  
  - loader.js:985 Module.load
    internal/modules/cjs/loader.js:985:32
  
  - loader.js:878 Function.Module._load
    internal/modules/cjs/loader.js:878:14
  
  - loader.js:1025 Module.require
    internal/modules/cjs/loader.js:1025:19
  
  - v8-compile-cache.js:159 require
    [fit_gatsby]/[v8-compile-cache]/v8-compile-cache.js:159:20
  
  - safe-sharp.js:127 Object.<anonymous>
    [fit_gatsby]/[gatsby-plugin-sharp]/safe-sharp.js:127:11
  
  - v8-compile-cache.js:192 Module._compile
    [fit_gatsby]/[v8-compile-cache]/v8-compile-cache.js:192:30
  

not finished load plugins - 9.853s

npm rebuild --verbose sharp

npm info ok 

Gatsby develop

Error in "/Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby-transformer-sharp/gatsby-node.js":
Something went wrong installing the "sharp" module

dlopen(/Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby-plugin-sharp/node_modules/sharp/build/Release/sharp.n
ode, 1): Symbol not found: __ZTVN4vips7VOptionE
  Referenced from:
/Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby-plugin-sharp/node_modules/sharp/build/Release/sharp.node
  Expected in: flat namespace
 in /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby-plugin-sharp/node_modules/sharp/build/Release/sharp.node

- Remove the "node_modules/sharp" directory then run
  "npm install --ignore-scripts=false --verbose" and look for errors
- Consult the installation documentation at https://sharp.pixelplumbing.com/install
- Search for this error at https://github.com/lovell/sharp/issues




  Error: Something went wrong installing the "sharp" module
  dlopen(/Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby-plugin-sharp/node_modules/sharp/build/Release/sharp
  .node, 1): Symbol not found: __ZTVN4vips7VOptionE
    Referenced from: /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby-plugin-sharp/node_modules/sharp/build/R
  elease/sharp.node
    Expected in: flat namespace
   in /Users/langchen/Documents/WebDev/Fraser/fit_gatsby/node_modules/gatsby-plugin-sharp/node_modules/sharp/build/Release/sharp.no
  de
  - Remove the "node_modules/sharp" directory then run
    "npm install --ignore-scripts=false --verbose" and look for errors
  - Consult the installation documentation at https://sharp.pixelplumbing.com/install
  - Search for this error at https://github.com/lovell/sharp/issues
  
  - constructor.js:34 Object.<anonymous>
    [fit_gatsby]/[gatsby-plugin-sharp]/[sharp]/lib/constructor.js:34:9
  
  - v8-compile-cache.js:192 Module._compile
    [fit_gatsby]/[v8-compile-cache]/v8-compile-cache.js:192:30
  
  - loader.js:1157 Object.Module._extensions..js
    internal/modules/cjs/loader.js:1157:10
  
  - loader.js:985 Module.load
    internal/modules/cjs/loader.js:985:32
  
  - loader.js:878 Function.Module._load
    internal/modules/cjs/loader.js:878:14
  
  - loader.js:1025 Module.require
    internal/modules/cjs/loader.js:1025:19
  
  - v8-compile-cache.js:159 require
    [fit_gatsby]/[v8-compile-cache]/v8-compile-cache.js:159:20
  
  - index.js:3 Object.<anonymous>
    [fit_gatsby]/[gatsby-plugin-sharp]/[sharp]/lib/index.js:3:15
  
  - v8-compile-cache.js:192 Module._compile
    [fit_gatsby]/[v8-compile-cache]/v8-compile-cache.js:192:30
  
  - loader.js:1157 Object.Module._extensions..js
    internal/modules/cjs/loader.js:1157:10
  
  - loader.js:985 Module.load
    internal/modules/cjs/loader.js:985:32
  
  - loader.js:878 Function.Module._load
    internal/modules/cjs/loader.js:878:14
  
  - loader.js:1025 Module.require
    internal/modules/cjs/loader.js:1025:19
  
  - v8-compile-cache.js:159 require
    [fit_gatsby]/[v8-compile-cache]/v8-compile-cache.js:159:20
  
  - safe-sharp.js:127 Object.<anonymous>
    [fit_gatsby]/[gatsby-plugin-sharp]/safe-sharp.js:127:11
  
  - v8-compile-cache.js:192 Module._compile
    [fit_gatsby]/[v8-compile-cache]/v8-compile-cache.js:192:30
  

not finished load plugins - 10.084s

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 18 (8 by maintainers)

Most upvoted comments

sharp v0.29.0 is now available and provides prebuilt M1-compatible binaries for libvips and sharp. Please can you try to upgrade.

Thanks so much for the effort, now it’s finally working! 🎉🎉🎉