Mac安装 yarn

2022-08-24 19:28:03 浏览数 (1)

大家好,又见面了,我是你们的朋友全栈君。

Mac安装 yarn

  • Mac安装yarn
  • 一、按照提示安装gcc
  • 二、解决gcc错误的方法
  • 三、安装 yarn
  • 四、配置V**后,再次安装 yarn
  • 五、下载 yarn的 tar.gz包,进行离线安装。

Mac安装yarn

Mac升级到10.15.4之后,Xcode也升级到Version 11.4.1 (11E503a),终端下执行 brew install yarn 进行 yarn安装,最后报错gcc错误。

代码语言:javascript复制
Error: An exception occurred within a child process:
  CompilerSelectionError: gcc cannot be built with any available compilers.
Install GNU's GCC:
  brew install gcc

一、按照提示安装gcc

既然gcc错误,直接安装gcc 执行 brew install gcc 错误如下:

代码语言:javascript复制
$ brew install gcc
Updating Homebrew...
Warning: Building gcc from source:
  The bottle needs the Xcode CLT to be installed.
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: gcc cannot be built with any available compilers.
Install GNU's GCC:
  brew install gcc

so,度娘试试看:

原因是 在从App Store上下载Xcode后,默认是不会安装Command Line Tools的.

二、解决gcc错误的方法

更新一下Xcode,终端下执行指令:

代码语言:javascript复制
xcode-select --install

执行结果如下:

代码语言:javascript复制
$ xcode-select --install
xcode-select: note: install requested for command line developer tools

三、安装 yarn

代码语言:javascript复制
$ brew install yarn
Updating Homebrew...
==> Downloading https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws
#                                                                          2.8%
curl: (56) LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 60
Error: An exception occurred within a child process:
  DownloadError: Failed to download resource "yarn"
Download failed: https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz

网速问题,那么,配置V**吧。 如果没有V**的话,参考第五步。

四、配置V**后,再次安装 yarn

代码语言:javascript复制
$ brew install yarn
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
feedgnuplot            geoipupdate            mariadb                repo
fonttools              glooctl                mariadb@10.2

==> Downloading https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz
==> Downloading from https://github-production-release-asset-2e65be.s3.amazonaws.com/4997064
######################################################################## 100.0%



	

0 人点赞