yarnをインストールするときに詰まった

こんにちは、Yumihikiです。

 

今日はyarnをインストールするときに詰まったので、対処法を含めて簡単にログを残しておきたいと思います。

 

まず始めに

brew install yarnしたら次のメッセージが出ました。

 

Updating Homebrew...

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

==> Auto-updated Homebrew!

Updated 3 taps (homebrew/cask-versions, homebrew/core and homebrew/cask).

==> Updated Formulae

abcm2ps             flatcc              github-keygen       imagemagick         liblcf              mgba                ori                 polyml              s3ql                tbb

anycable-go         fortio              glooctl             istioctl            liblwgeom           micropython         osc                 postgis             sdl2                topgrade

awscli              frugal              gmt                 json-fortran        librasterlite       mingw-w64           osm2pgsql           presto              simple-tiles        vim

bartycrouch         fselect             gmt@4               juju                libspatialite       nano                pcl                 proj                spatialite-gui      vtk

bind                futhark             gosu                khal                libssh2             nave                pdal                ptex                spatialite-tools    wtf

cppad               gdal                hadolint            kubernetes-cli      llnode              nco                 pdftoedn            pushpin             spirv-cross         xcodegen

derby               gearboy             hapi-fhir-cli       lf                  mapnik              ncview              pgrouting           rancher-cli         stellar-core        xpa

dssim               gearsystem          helmfile            libgaiagraphics     mapserver           netcdf              picard-tools        rbenv               swagger-codegen@2   xxhash

ffsend              git-fixup           help2man            libgeotiff          maxwell             odpi                points2grid         rst-lint            sxiv                zabbix

 

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

Error: An exception occurred within a child process:

  CompilerSelectionError: yarn cannot be built with any available compilers.

Install GNU's GCC

  brew install gcc

 

 

次に brew install gcc を実行したら

MyMBP:~ tatsuya$ brew install gcc

Error: The following formula

  gcc

cannot be installed as binary package and must be built from source.

Install the Command Line Tools:

  xcode-select --install

 

そして、xcode-select --install を実行したら、x-codeをダウンロードするか聞かれるので、ダウンロードしたところ

brew install gccbrew install yarn が実行できるようになりました。