【问题标题】:npm install error - No Xcode or CLT version detected?npm 安装错误 - 未检测到 Xcode 或 CLT 版本?
【发布时间】:2020-11-27 16:55:37
【问题描述】:

“在 '/' 处找不到 'com.apple.pkg.cltools_executables' 的收据”

在 MacOS (Catalina) 的 VS Code bash 终端中为 Angular 9 项目运行“npm install”时引发上述错误

Package.json 依赖项:

    "@angular/animations": "~9.1.1",
    "@angular/common": "~9.1.1",
    "@angular/compiler": "~9.1.1",
    "@angular/core": "~9.1.1",
    "@angular/platform-browser": "~9.1.1",
    "@angular/platform-browser-dynamic": "~9.1.1",
    "@angular/router": "~9.1.1",
    "rxjs": "~6.5.4",
    "tslib": "1.10.0",
    "zone.js": "0.10.2"

【问题讨论】:

  • 是的!这让我一整天都在搞砸!

标签: angular npm-install package.json macos-catalina


【解决方案1】:

我按照以下步骤完成了这项工作:

  • 找出命令行工具的路径 xcode-select --print-path

  • 删除命令行工具目录(目录路径可从上述步骤中获取) sudo rm -rf /Library/Developer/CommandLineTools

  • 运行这个重新安装 xcode-select --install

发布这个,'npm install' 应该在 MacOS bash 终端的 VS Code 上成功运行。

【讨论】:

  • sudo rm -rf $(xcode-select --print-path) 只是为了确保您正确复制它
  • 这不适用于 Big Sur 和 Xcode 12.5
猜你喜欢
  • 2020-06-19
  • 2021-10-03
  • 2016-10-01
  • 2013-09-04
  • 2017-10-04
  • 1970-01-01
  • 2021-12-12
  • 2022-06-26
相关资源
最近更新 更多