sharp: Segmentation Fault under Rosetta emulation, Node.js 14, M1 Max, macOS Monterey

Related issue: https://github.com/ionic-team/capacitor-assets/issues/272

Sharp is causing a segmentation fault when converting images on my Mac.

I have macOS Monterey, on an M1 Max chip.

When I download sharp locally and run npm test, I get:



> sharp@0.29.3 test /Users/joshua/Projects/sharp
> npm run test-lint && npm run test-unit && npm run test-licensing


> sharp@0.29.3 test-lint /Users/joshua/Projects/sharp
> semistandard && cpplint


> sharp@0.29.3 test-unit /Users/joshua/Projects/sharp
> nyc --reporter=lcov --branches=99 mocha --slow=1000 --timeout=60000 ./test/unit/*.js



  Affine transform
    ✔ Applies identity matrix
    ✔ Applies resize affine matrix
    ✔ Resizes and applies affine transform
    1) Extracts and applies affine transform
    ✔ Rotates and applies affine transform
    2) Extracts, rotates and applies affine transform
    3) Applies affine transform with background color
    ✔ Applies affine transform with background color and output offsets
    4) Applies affine transform with background color and all offsets
    Invalid input
      ✔ Missing matrix
      ✔ Invalid 1d matrix
      ✔ Invalid 2d matrix
      ✔ Invalid options parameter type
      ✔ Invalid background color
      ✔ Invalid idx offset type
      ✔ Invalid idy offset type
      ✔ Invalid odx offset type
      ✔ Invalid ody offset type
      ✔ Invalid interpolator
    Interpolations
      5) Performs 2x upscale with nearest interpolation
      ✔ Performs 2x upscale with bilinear interpolation
      6) Performs 2x upscale with bicubic interpolation
      7) Performs 2x upscale with locallyBoundedBicubic interpolation
      ✔ Performs 2x upscale with nohalo interpolation
      8) Performs 2x upscale with vertexSplitQuadraticBasisSpline interpolation

  HTTP agent
    ✔ Without proxy
    ✔ HTTPS proxy with auth from HTTPS_PROXY
    ✔ HTTPS proxy with auth from HTTPS_PROXY using credentials containing special characters
    ✔ HTTP proxy without auth from npm_config_proxy

  Alpha transparency
sh: line 1: 79897 Segmentation fault: 11  npm run test-unit
npm ERR! Test failed.  See above for more details.

It’s not random, the same tests fail each time.


  System:
    OS: macOS 12.1
    CPU: (10) x64 Apple M1 Max
    Memory: 160.91 MB / 32.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 14.18.1 - /usr/local/bin/node
    npm: 6.14.15 - /usr/local/bin/npm

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 20 (11 by maintainers)

Most upvoted comments

looks like it worked, all tests are passing!