developer-portal-starter icon indicating copy to clipboard operation
developer-portal-starter copied to clipboard

Running Redocly locally on Mac M1

Open RoughRyde opened this issue 4 years ago • 9 comments

Hi,

I get get the following errors when running yarn start on my Macbook Air with M1 processor:

Error: Something went wrong installing the "sharp" module
  dlopen(/Users/***/src/external-documentation/node_modules/@redocly/gat  sby-plugin-sharp/node_modules/sharp/build/Release/sharp.node, 1): Symbol not f  ound: __ZTVN4vips7VOptionE
    Referenced from: /Users/fredrikryde/src/external-documentation/node_modules/  @redocly/gatsby-plugin-sharp/node_modules/sharp/build/Release/sharp.node
    Expected in: flat namespace
   in /Users/fredrikryde/src/external-documentation/node_modules/@redocly/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/in  stall
  - Search for this error at https://github.com/lovell/sharp/issues

I followed the steps above but with no success. My guess is it has something to do with my new M1 Mac

Running Node 14.15.4

Any help would be much appreciated .

RoughRyde avatar Feb 09 '21 09:02 RoughRyde

I apologize -- I hadn't seen this earlier. Is this issue still ongoing?

Sharp is a real amazing library and a real challenge too. Let us see if anyone on our team already has an M1, or if we can find some info about sharp/M1 compatibility...

adamaltman avatar Mar 19 '21 13:03 adamaltman

Hey @RoughRyde, since beta.120 version of developer portal we disabled image optimizations by default in the portal and made sharp an optional dependency. You may still see the error installing it but it should continue to work.

You can also use yarn install --ignore-optional.

RomanHotsiy avatar Mar 19 '21 20:03 RomanHotsiy

I almost justified buying the M1.

adamaltman avatar Mar 19 '21 20:03 adamaltman

screenshot-error

Even with yarn install --ignore-optional installing won't work on a M1; see above screenshot

Once libvips is installed globally however, there is no issue. Recently added to the Sharp docs: https://sharp.pixelplumbing.com/install#apple-m1

Most easy way to do this is via Brew, with the command brew install vips. So, for the developer portal this step should come before yarn install for M1 users. Tested and working.

P.S. @adamaltman I would still get that M1 ;)

MarcoDeJong avatar Apr 16 '21 06:04 MarcoDeJong

Someone has reported a workaround using the brew install vips you suggested (thanks @MarcoDeJong ):

brew install vips
rm -rf ./node_modules
yarn cache clean
yarn

adamaltman avatar Jun 15 '21 15:06 adamaltman

Having the same issue on a MacBook Pro M1. The workaround with brew install vips fails for me due to a vips open-mpi dependency.

Screen Shot 2021-06-28 at 2 45 39 PM

Feels like a rabbit hole. Any suggestions?

pkwade avatar Jun 28 '21 18:06 pkwade

That is more related to your local environment, then the developer portal.

Your brew or any formula is probably outdated. Run brew update then check brew doctor or brew outdated

MarcoDeJong avatar Jun 29 '21 05:06 MarcoDeJong

I was struggling with a similar error, but was on the yarn install step, and found that downgrading from node16 to node14 fixed my issue for me.

stefprez avatar Mar 04 '22 19:03 stefprez

This worked w/ node 16.14.0 && "@redocly/developer-portal": "1.1.0-beta.85"

brew install vips rm -rf ./node_modules yarn install

wibobm avatar Mar 20 '22 03:03 wibobm