11

I am facing an error which running "npm install" (see picture attached)

  • node version: 10.7.0, npm version: 6.1.0
  • MacOs version: 10.15.6

It's a react native project (i'll be working on iOS part), and the package.json is as:

{
    "name": "abc",
    "version": "0.0.1",
    "private": true,
    "scripts": {
        "postinstall": "./postinstall.sh",
        "start": "react-native start",
        "test": "jest"
    },
    "dependencies": {
        "alt": "^0.18.6",
        "alt-utils": "^2.0.0",
        "axios": "^0.19.2",
        "enumify": "^1.0.4",
        "fs": "0.0.1-security",
        "native-navigation": "https://github.com/abc/native-navigation.git",
        "prop-types": "^15.6.0",
        "react": "16.9.0",
        "react-native": "^0.63.2",
        "react-native-fs": "^2.14.1",
        "react-native-iphone-x-helper": "^1.0.2",
        "react-native-keyboard-aware-scroll-view": "^0.4.2",
        "react-native-multi-validation": "^1.0.0",
        "react-native-navigation": "2.0.2179",
        "react-native-simple-radio-button": "^2.7.1",
        "react-native-webview": "6.0.2",
        "snakecase-keys": "^1.1.0",
        "urijs": "^1.19.0"
    },
    "devDependencies": {
        "@babel/core": "^7.6.2",
        "@babel/runtime": "^7.6.2",
        "babel-jest": "^24.9.0",
        "jest": "^24.9.0",
        "metro-react-native-babel-preset": "^0.56.0",
        "babel-plugin-module-resolver": "2.3.0",
        "babel-preset-es2015": "^6.24.1",
        "babel-preset-react-native": "4.0.1",
        "react-test-renderer": "16.9.0"
    },
    "jest": {
        "preset": "react-native"
    }
}

What I tried:

I installed watchman using brew install watchman, tried printing logs while installing packages but it didn't work for me.

Error Message:

enter image description here

8 Answers 8

8

I had a same problem when update os to Catalina, try to update(reinstall) llvm and gcc and then reinstall xcode command-line tools:

$ brew upgrade llvm
$ brew upgrade gcc
$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install

you may need to restart the system

4
  • Unfortunately this results in "Can't install the software because it is not currently available from the Software Update server." If I install it directly from the DMG from the Apple Developer site, I'm presented with the same error from the OP. Sep 23, 2020 at 16:01
  • I'm not sure, but you can try to use command sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
    – omnomnom
    Sep 24, 2020 at 19:28
  • I get: Error: llvm not installed. Maybe worthwhile suggesting to install if not present.
    – Riccardo
    Nov 28, 2020 at 16:22
  • As I understand it, this error occurs due to the system linker (uses old linker with new sdk?). In my case, I'm trying to compile go code. In the case of nodejs, it tries to install modules written in c/c++ and use clang(llvm) or gcc for this, but both variants use the "system linker", which returns the same error. In your case, it is possible that llvm is not used for compiling the module, or it is not installed via "brew", so if it is not explicitly required, then you can not install it, as well as gcc.
    – omnomnom
    Dec 3, 2020 at 14:09
8

In macOS Ventura, I was facing this issue because the version used by Anaconda is different from the version required by xcode. So, I had to deactivate conda before compiling my C++ code.

2
  • 1
    Anaconda env's effect. After conda deactivate, all things went well.
    – Bruce Yang
    Jan 31 at 3:46
  • 1
    OK this thing worked for me...I thought anaconda was only a python thing.
    – Duo Tao
    Feb 7 at 18:09
7

It seems that Command Line Tools for Xcode 12 is not compatible with macOS Catalina (or there are some missing packages within the CLT).

After removing it and installing Command Line Tools for Xcode 11.5, no more errors are generated like this.

Avoid me spending hours to download XCode just to get CLT working.

sudo rm -rf /Library/Developer/CommandLineTools
2
  • +1 I spend 2 days troubleshooting before realized that commandline tools can be different version than xcode.
    – Chugaister
    Jan 18, 2021 at 9:55
  • The same issue is present with macOS Monterey. The lowest command line tools version I could install was 13.1, but the issue is still present.
    – gunes
    Jan 14 at 20:45
5

This issue blocks me for a long while, and I finally find the solution.

Yes, it is caused by incorrect CommandLineTools. But, do not use the latest CommandLineTool.

XCode 12 may occur this issue. So, the correct solution is, downgrade to 11.5!

  1. Download Command Line Tools for Xcode 11.5 (not tested whether 11.6 and 11.7 work) from: https://developer.apple.com/download/more/

  2. Remove existing CommandLineTools: sudo rm -rf /Library/Developer/CommandLineTools

  3. install downloaded CommandLineTools.

Done.

3
  • 2
    The Command Line Tools for Xcode 11.5 can't be installed with macOS version 11.2.3. The installation prompt says the macOS version is too new. Any ideas?
    – Shashank
    May 6, 2021 at 13:12
  • I am also encountering this error on macOS Big Sur, and can't revert to 11.5 since it's incompatible. Is there a way to force macOS to install a potentially incompatible version or to manually patch the bug? Any suggestions would be greatly appreciated. Jun 21, 2021 at 18:19
  • Any ideas on what to do with macOS Monterey? I tried command line tools version 13.1, but didn't work.
    – gunes
    Jan 14 at 20:46
1

I did

$ sudo xcode-select --switch /Library/Developer/CommandLineTools

and it fixed my problem.

1
  • This worked for me!
    – JakeTuero
    Sep 5 at 6:09
0

This worked for me. Running Catalina

sudo rm -rf /Library/Developer/CommandLineTools

Download CommandLineTools 11.5 from developer.apple.com/all/ as suggested.

configure now works correctly

1
  • What do you mean by "configure now works correctly"?
    – gunes
    Jan 14 at 20:15
0

One solution for those who have Big Sur: the 11.5 command-line tool will not install with an error saying your macOS is too new. The 12.2 command-line tool downloaded from the Apple developer website worked for me (it can be installed without an issue and my code can be compiled without saying linker failure).

1
  • 2
    As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
    – Community Bot
    Oct 22, 2021 at 18:15
0

For those of us who use custom toolchains besides the default Xcode toolchains, I have found that this same error message could show up when using a custom toolchain that only works up to Xcode 11.7, in Xcode 12.4

Here's where you can check which toolchain you are using.

where to see the selected toolchain

Switching the toolchain to "Xcode 12.4" resulted in the error going away.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.