草庐IT

pnpm简介与mac电脑使用 HomeBrew安装pnpm报错记录fatal: not in a git directory Error: Command failed with exit 128

百事可口 2023-04-29 原文

pnpm简介

pnpm( performant npm )是一个同npm、yarn类似的前端node_module包管理工具,其初衷是节约磁盘空间并提升安装速度。

pnpm 优势

软链接优化依赖管理

官网地址:pnpm官网

命令对比

npmyarnpnpm
npm installyarnpnpm install
npm install 包名yarn add 包名pnpm add 包名
npm uninstall 包名yarn remove 包名pnpm remove 包名
npm run 脚本yarn 脚本pnpm 脚本

安装

通过 npm 安装

npm install -g pnpm

通过HomeBrew 安装

这里我使用的是HomeBrew

1. 第一步 输入命令

 brew install pnpm

代码如下,然后报错

runnumb@RundeMacBook-Pro nxin-code % brew install pnpm
fatal: not in a git directory
Warning: No remote 'origin' in /opt/homebrew/Library/Taps/homebrew/homebrew-cask, skipping update!
fatal: not in a git directory
Warning: No remote 'origin' in /opt/homebrew/Library/Taps/homebrew/homebrew-core, skipping update!
fatal: not in a git directory
Warning: No remote 'origin' in /opt/homebrew/Library/Taps/homebrew/homebrew-services, skipping update!
==> Homebrew has enabled anonymous aggregate formula and cask analytics.
Read the analytics documentation (and how to opt-out) here:
  https://docs.brew.sh/Analytics
No analytics have been recorded yet (nor will be during this `brew` run).

==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
  https://github.com/Homebrew/brew#donations

==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/pnpm-7.17.1.arm64_ventura.bottle.tar.gz
curl: (22) The requested URL returned error: 404                              

Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/pnpm/manifests/7.17.1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/pnpm/blobs/sha256:4315d45611ecd4410d2dda95beb0148133fc4529a5282811665598ccdf1dfd09
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:4315d45611ecd4410d2dda95beb0148133fc4529a5282811665598ccdf1dfd09?se=2023-01-31T03%3A05%3A
######################################################################## 100.0%
fatal: not in a git directory
Error: Command failed with exit 128: git

解决办法:

brew -v 查看会有两个提示,提示用户设置 homebrew-cask 和 homebrew-core 的文件路径为设置为safe.directory

runnumb@RundeMacBook-Pro nxin-code % brew -v
Homebrew 3.6.12-20-g9c88c39
fatal: detected dubious ownership in repository at '/opt/homebrew/Library/Taps/homebrew/homebrew-core'
To add an exception for this directory, call:

        git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core
Homebrew/homebrew-core (no Git repository)
fatal: detected dubious ownership in repository at '/opt/homebrew/Library/Taps/homebrew/homebrew-cask'
To add an exception for this directory, call:

        git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask
Homebrew/homebrew-cask (no Git repository)

2.这时按照终端给的提示吗,分别使用两个命令,如下

git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core
git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask

示例如下:

runnumb@RundeMacBook-Pro nxin-code % git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-core
runnumb@RundeMacBook-Pro nxin-code % git config --global --add safe.directory /opt/homebrew/Library/Taps/homebrew/homebrew-cask
runnumb@RundeMacBook-Pro nxin-code % brew -v
Homebrew 3.6.12-20-g9c88c39
Homebrew/homebrew-core (git revision 4cdce4bfdd2; last commit 2022-11-29)
Homebrew/homebrew-cask (git revision 11c175be64; last commit 2022-11-29)

3. 然后再执行:

 arch -arm64 brew install cocoapods

示例如下:

runnumb@RundeMacBook-Pro nxin-code % arch -arm64 brew install cocoapods
fatal: not in a git directory
Warning: No remote 'origin' in /opt/homebrew/Library/Taps/homebrew/homebrew-services, skipping update!
Warning: Treating cocoapods as a formula. For the cask, use homebrew/cask/cocoapods
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/libyaml-0.2.5.arm64_ventura.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/ca-certificates-2022-10-11.all.bottle.tar.gz
curl: (22) The requested URL returned error: 404                              

Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/manifests/2022-10-11
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/ca-certificates/blobs/sha256:1b264e579e31b3041a87ff91f09d5f7cc0d51fea1c83e63aee17a1b95509cbe1
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:1b264e579e31b3041a87ff91f09d5f7cc0d51fea1c83e63aee17a1b95509cbe1?se=2023-01-31T03%3A10%3A
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/openssl%401.1-1.1.1s.arm64_ventura.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/readline-8.2.1.arm64_ventura.bottle.tar.gz
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/ruby-3.1.2_1.arm64_ventura.bottle.1.tar.gz
curl: (22) The requested URL returned error: 404

Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/ruby/manifests/3.1.2_1-1
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/ruby/blobs/sha256:75974aaea5681d1d141f12625c15c19e0e0324ade9a5bbe37945c7b4a7323c58
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:75974aaea5681d1d141f12625c15c19e0e0324ade9a5bbe37945c7b4a7323c58?se=2023-01-31T03%3A10%3A
######################################################################## 100.0%
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/cocoapods-1.11.3.arm64_ventura.bottle.tar.gz
curl: (22) The requested URL returned error: 404                              

Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/cocoapods/manifests/1.11.3
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/cocoapods/blobs/sha256:d7a566fdc19b54792dfb58a70126d9a847fbdcc4eb4fd0c3c402cc143fcdf704
==> Downloading from https://pkg-containers.githubusercontent.com/ghcr1/blobs/sha256:d7a566fdc19b54792dfb58a70126d9a847fbdcc4eb4fd0c3c402cc143fcdf704?se=2023-01-31T03%3A25%3A
######################################################################## 100.0%
==> Installing dependencies for cocoapods: libyaml, ca-certificates, openssl@1.1, readline and ruby
==> Installing cocoapods dependency: libyaml
==> Pouring libyaml-0.2.5.arm64_ventura.bottle.tar.gz
🍺  /opt/homebrew/Cellar/libyaml/0.2.5: 10 files, 351.2KB
==> Installing cocoapods dependency: ca-certificates
==> Pouring ca-certificates-2022-10-11.all.bottle.tar.gz
Error: No such file or directory @ rb_sysopen - /Users/runnumb/Library/Caches/Homebrew/downloads/45aa6cd2270164620e943b04684f2aab7fc067bf491eef09870797858dfc7679--ca-certificates-2022-10-11.all.bottle.tar.gz

4. 最后再次执行

 brew install pnpm

示例如下:

runnumb@RundeMacBook-Pro nxin-code % brew install pnpm
fatal: not in a git directory
Warning: No remote 'origin' in /opt/homebrew/Library/Taps/homebrew/homebrew-services, skipping update!
==> Downloading https://mirrors.ustc.edu.cn/homebrew-bottles/pnpm-7.17.1.arm64_ventura.bottle.tar.gz
curl: (22) The requested URL returned error: 404

Warning: Bottle missing, falling back to the default domain...
==> Downloading https://ghcr.io/v2/homebrew/core/pnpm/manifests/7.17.1
Already downloaded: /Users/runnumb/Library/Caches/Homebrew/downloads/b220af0f800bc33ba56eb10795f2f6922a466b972ddc4b12570fb27b155331cc--pnpm-7.17.1.bottle_manifest.json
==> Downloading https://ghcr.io/v2/homebrew/core/pnpm/blobs/sha256:4315d45611ecd4410d2dda95beb0148133fc4529a5282811665598ccdf1dfd09
Already downloaded: /Users/runnumb/Library/Caches/Homebrew/downloads/8f772b16919f8a48871542061254827ac4ef30536704e9c96c6c6b14d3bd77dc--pnpm--7.17.1.arm64_ventura.bottle.tar.gz
==> Pouring pnpm--7.17.1.arm64_ventura.bottle.tar.gz
==> Caveats
pnpm requires a Node installation to function. You can install one with:
  brew install node
==> Summary
🍺  /opt/homebrew/Cellar/pnpm/7.17.1: 659 files, 12.0MB
==> Running `brew cleanup pnpm`...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP.
Hide these hints with HOMEBREW_NO_ENV_HINTS (see `man brew`).

最后安装成功 pnpm -v 查看版本即可

参考资料:https://blog.csdn.net/Morris_/article/details/125182905

有关pnpm简介与mac电脑使用 HomeBrew安装pnpm报错记录fatal: not in a git directory Error: Command failed with exit 128的更多相关文章

  1. ruby-on-rails - 如何在 mac os snow leopard 中升级 ruby​​ 和 rails - 2

    我想将我的MacSnowLeopardruby​​从1.8.7升级到1.9.1版本,有人知道轻松且最好的升级方法吗?因为我读了一些论坛/帖子/博客/讨论说覆盖苹果发布的ruby不好将Rails从版本2.2.2升级到2.3.8的最佳方法是什么?因为我找到的所有信息都仅适用于豹/老虎,而且很少有关于雪豹的复杂文章。他们还说覆盖apple提供的rails不好吗。谁能帮帮我?谢谢。 最佳答案 DanBenjamin有一些greatinstructionsforcompilingandinstallingRuby,RubyGemsandRai

  2. ruby - 在不使用 RVM 的情况下在 Mac 上卸载和升级 Ruby - 2

    我最近决定从我的系统中卸载RVM。在thispage提出的一些论点说服我:实际上,我的决定是,我根本不想担心Ruby的多个版本。我只想使用1.9.2-p290版本而不用担心其他任何事情。但是,当我在我的Mac上运行ruby--version时,它告诉我我的版本是1.8.7。我四处寻找如何简单地从我的Mac上卸载这个Ruby,但奇怪的是我没有找到任何东西。似乎唯一想卸载Ruby的人运行linux,而使用Mac的每个人都推荐RVM。如何从我的Mac上卸载Ruby1.8.7?我想升级到1.9.2-p290版本,并且我希望我的系统上只有一个版本。 最佳答案

  3. 电脑0x0000001A蓝屏错误怎么U盘重装系统教学 - 2

      电脑0x0000001A蓝屏错误怎么U盘重装系统教学分享。有用户电脑开机之后遇到了系统蓝屏的情况。系统蓝屏问题很多时候都是系统bug,只有通过重装系统来进行解决。那么蓝屏问题如何通过U盘重装新系统来解决呢?来看看以下的详细操作方法教学吧。  准备工作:  1、U盘一个(尽量使用8G以上的U盘)。  2、一台正常联网可使用的电脑。  3、ghost或ISO系统镜像文件(Win10系统下载_Win10专业版_windows10正式版下载-系统之家)。  4、在本页面下载U盘启动盘制作工具:系统之家U盘启动工具。  U盘启动盘制作步骤:  注意:制作期间,U盘会被格式化,因此U盘中的重要文件请注

  4. HBase Region 简介和建议数量&大小 - 2

    Region是HBase数据管理的基本单位,region有一点像关系型数据的分区。region中存储这用户的真实数据,而为了管理这些数据,HBase使用了RegionSever来管理region。Region的结构hbaseregion的大小设置默认情况下,每个Table起初只有一个Region,随着数据的不断写入,Region会自动进行拆分。刚拆分时,两个子Region都位于当前的RegionServer,但处于负载均衡的考虑,HMaster有可能会将某个Region转移给其他的RegionServer。RegionSplit时机:当1个region中的某个Store下所有StoreFile

  5. ruby-on-rails - gem install rmagick -v 2.13.1 错误 Failed to build gem native extension on Mac OS 10.9.1 - 2

    我已经通过提供MagickWand.h的路径尝试了一切,我安装了命令工具。谁能帮帮我?$geminstallrmagick-v2.13.1Buildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingrmagick:ERROR:Failedtobuildgemnativeextension./Users/ghazanfarali/.rvm/rubies/ruby-1.8.7-p357/bin/rubyextconf.rbcheckingforRubyversion>=1.8.5...yescheckingfor/

  6. ruby - 在 TCPServer (Ruby) 中,我如何从客户端获取 IP/MAC? - 2

    我想在Ruby的TCPServer中获取客户端的IP地址。以及(如果可能的话)MAC地址。例如,Ruby中的时间服务器,请参阅评论。tcpserver=TCPServer.new("",80)iftcpserverputs"Listening"loopdosocket=tcpserver.acceptifsocketThread.newdoputs"Connectedfrom"+#HERE!HowcanigettheIPAddressfromtheclient?socket.write(Time.now.to_s)socket.closeendendendend非常感谢!

  7. ruby - 安装 tiny_tds 在 mac os 10.10.5 上出现错误 - 2

    我正在使用macos,我想使用ruby​​驱动程序连接到sqlserver。我想使用tiny_tds,但它给出了缺少free_tds的错误,但它已经安装了。怎么能过这个?~brewinstallfreetdsWarning:freetds-0.91.112alreadyinstalled~sudogeminstalltiny_tdsBuildingnativeextensions.Thiscouldtakeawhile...ERROR:Errorinstallingtiny_tds:ERROR:Failedtobuildgemnativeextension.完整日志如下:/System

  8. 电脑启动后显示器黑屏怎么办?排查下面4个问题,快速解决 - 2

    电脑启动出现显示器黑屏是一个相当常见的问题。如果您遇到了这个问题,不要惊慌,因为它有很多可能的原因,可以采取一些简单的措施来解决它。在本文中,小编将介绍下面4种常见的电脑启动后显示器黑屏的原因,排查这些原因,快速解决! 演示机型:联想Ideapad700-15ISK-ISE系统版本:Windows10一、显示器问题如果出现电脑启动后显示器黑屏的情况。那么首先您需要检查一下显示器是否正常工作。您可以通过更换另一个显示器或将当前显示器连接到另一台计算机来检查显示器是否存在问题。如果问题仍然存在,那么您可以排除显示器故障的可能性。 二、显卡问题如果您的电脑配备了独立显卡,那么显卡故障也可能是导致电脑

  9. 电脑怎么截图?进来看(8种常用截图方法) - 2

    电脑上可以截取图片吗?如果可以,该如何操作呢?相信很多小伙伴都只知道一两种截图的方式,知道的并不全面。其实,电脑上有多种方式截图的,而且非常方便。电脑怎么截图?今天我们就来教大家如何使用电脑截取图片的8种常用方式!操作环境:演示机型:Delloptiplex7050系统版本:Windows10方法一:系统自带截图具体操作:同时按下电脑的自带截图键【Windows+shift+S】,可以选择其中一种方式来截取图片:截屏有矩形截屏、任意形状截屏、窗口截屏和全屏截图。 方法二:QQ截图具体操作:在电脑登录QQ,然后同时按下【Ctrl+Alt+A】,可以任意截图你需要的界面,可以把截图的页面直接下载,

  10. ruby - 如何在Elixir中使用AES CBC 128进行加密和解密 - 2

    我在Rails中有一个具有以下方法的应用程序,该方法可以加密和解密文本并与Java客户端通信。defencrypt(string,key)cipher=OpenSSL::Cipher::AES.new(128,:CBC)cipher.encryptcipher.padding=1cipher.key=hex_to_bin(Digest::SHA1.hexdigest(key)[0..32])cipher_text=cipher.update(string)cipher_textexcenddefhex_to_bin(str)[str].pack"H*"enddefbin_to_hex(

随机推荐