大家好,又见面了,我是你们的朋友全栈君。
Mac安装 yarn
Mac安装yarn
Mac升级到10.15.4之后,Xcode也升级到Version 11.4.1 (11E503a),终端下执行 brew install yarn 进行 yarn安装,最后报错gcc错误。
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
错误如下:
$ 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,终端下执行指令:
xcode-select --install
执行结果如下:
$ xcode-select --install
xcode-select: note: install requested for command line developer tools
三、安装 yarn
$ 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
网速问题,那么,配置VPN吧。
如果没有VPN的话,参考第五步。
四、配置VPN后,再次安装 yarn
$ 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%
? /usr/local/Cellar/yarn/1.22.4: 14 files, 5MB, built in 5 minutes 1 second
五、下载 yarn的 tar.gz包,进行离线安装。
(PS:没有尝试过,暂时不知道是否好用)
1、yarn的 tar.gz包下载地址:
https://yarnpkg.com/downloads/1.22.4/yarn-v1.22.4.tar.gz
2、离线安装参考文章:
https://www.cnblogs.com/luguiqing/p/11553067.html
参考文章:
1、https://www.cnblogs.com/qyf404/p/how_install_gcc_in_mac.html
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/141215.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...