source: trip-planner-front/node_modules/node-gyp/macOS_Catalina.md

Last change on this file was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 6.5 KB
Line 
1# Installation notes for macOS Catalina (v10.15)
2
3_This document specifically refers to upgrades from previous versions of macOS to Catalina (10.15). It should be removed from the source repository when Catalina ceases to be the latest macOS version or when future Catalina versions no longer raise these issues._
4
5**Both upgrading to macOS Catalina and running a Software Update in Catalina may cause normal `node-gyp` installations to fail. This might manifest as the following error during `npm install`:**
6
7```console
8gyp: No Xcode or CLT version detected!
9```
10
11## node-gyp v7
12
13The newest release of `node-gyp` should solve this problem. If you are using `node-gyp` directly then you should be able to install v7 and use it as-is.
14
15If you need to use `node-gyp` from within `npm` (e.g. through `npm install`), you will have to install `node-gyp` (either globally with `-g` or to a predictable location) and tell `npm` where the new version is. Either use:
16
17* `npm config set node_gyp <path to node-gyp>`; or
18* run `npm` with an environment variable prefix: `npm_config_node_gyp=<path to node-gyp> npm install`
19
20Where "path to node-gyp" is to the `node-gyp` executable which may be a symlink in your global bin directory (e.g. `/usr/local/bin/node-gyp`), or a path to the `node-gyp` installation directory and the `bin/node-gyp.js` file within it (e.g. `/usr/local/lib/node_modules/node-gyp/bin/node-gyp.js`).
21
22**If you use `npm config set` to change your global `node_gyp` you are responsible for keeping it up to date and can't rely on `npm` to give you a newer version when available.** Use `npm config delete node_gyp` to unset this configuration option.
23
24## Fixing Catalina for older versions of `node-gyp`
25
26### Is my Mac running macOS Catalina?
27Let's first make sure that your Mac is running Catalina:
28```
29% sw_vers
30 ProductName: Mac OS X
31 ProductVersion: 10.15
32 BuildVersion: 19A602
33```
34If `ProductVersion` is less then `10.15` then this document is not for you. Normal install docs for `node-gyp` on macOS can be found at https://github.com/nodejs/node-gyp#on-macos
35
36
37### The acid test
38To see if `Xcode Command Line Tools` is installed in a way that will work with `node-gyp`, run:
39```
40curl -sL https://github.com/nodejs/node-gyp/raw/master/macOS_Catalina_acid_test.sh | bash
41```
42
43If test succeeded, _you are done_! You should be ready to install `node-gyp`.
44
45If test failed, there is a problem with your Xcode Command Line Tools installation. [Continue to Solutions](#Solutions).
46
47### Solutions
48There are three ways to install the Xcode libraries `node-gyp` needs on macOS. People running Catalina have had success with some but not others in a way that has been unpredictable.
49
501. With the full Xcode (~7.6 GB download) from the `App Store` app.
512. With the _much_ smaller Xcode Command Line Tools via `xcode-select --install`
523. With the _much_ smaller Xcode Command Line Tools via manual download. **For people running the latest version of Catalina (10.15.2 at the time of this writing), this has worked when the other two solutions haven't.**
53
54### Installing `node-gyp` using the full Xcode
551. `xcodebuild -version` should show `Xcode 11.1` or later.
56 * If not, then install/upgrade Xcode from the App Store app.
572. Open the Xcode app and...
58 * Under __Preferences > Locations__ select the tools if their location is empty.
59 * Allow Xcode app to do an essential install of the most recent compiler tools.
603. Once all installations are _complete_, quit out of Xcode.
614. `sudo xcodebuild -license accept` # If you agree with the licensing terms.
625. `softwareupdate -l` # No listing is a good sign.
63 * If Xcode or Tools upgrades are listed, use "Software Upgrade" to install them.
646. `xcode-select -version` # Should return `xcode-select version 2370` or later.
657. `xcode-select -print-path` # Should return `/Applications/Xcode.app/Contents/Developer`
668. Try the [_acid test_ steps above](#The-acid-test) to see if your Mac is ready.
679. If the _acid test_ does _not_ pass then...
6810. `sudo xcode-select --reset` # Enter root password. No output is normal.
6911. Repeat step 7 above. Is the path different this time? Repeat the _acid test_.
70
71### Installing `node-gyp` using the Xcode Command Line Tools via `xcode-select --install`
721. If the _acid test_ has not succeeded, then try `xcode-select --install`
732. If the installation command returns `xcode-select: error: command line tools are already installed, use "Software Update" to install updates`, continue to [remove and reinstall](#i-did-all-that-and-the-acid-test-still-does-not-pass--)
743. Wait until the install process is _complete_.
754. `softwareupdate -l` # No listing is a good sign.
76 * If Xcode or Tools upgrades are listed, use "Software Update" to install them.
775. `xcode-select -version` # Should return `xcode-select version 2370` or later.
786. `xcode-select -print-path` # Should return `/Library/Developer/CommandLineTools`
797. Try the [_acid test_ steps above](#The-acid-test) to see if your Mac is ready.
808. If the _acid test_ does _not_ pass then...
819. `sudo xcode-select --reset` # Enter root password. No output is normal.
8210. Repeat step 5 above. Is the path different this time? Repeat the _acid test_.
83
84### Installing `node-gyp` using the Xcode Command Line Tools via manual download
851. Download the appropriate version of the "Command Line Tools for Xcode" for your version of Catalina from <https://developer.apple.com/download/more/>. As of MacOS 10.15.5, that's [Command_Line_Tools_for_Xcode_11.5.dmg](https://download.developer.apple.com/Developer_Tools/Command_Line_Tools_for_Xcode_11.5/Command_Line_Tools_for_Xcode_11.5.dmg)
862. Install the package.
873. Run the [_acid test_ steps above](#The-acid-test).
88
89### I did all that and the acid test still does not pass :-(
901. `sudo rm -rf $(xcode-select -print-path)` # Enter root password. No output is normal.
912. `sudo rm -rf /Library/Developer/CommandLineTools` # Enter root password.
923. `xcode-select --reset`
934. `xcode-select --install`
945. If the [_acid test_ steps above](#The-acid-test) still does _not_ pass then...
956. `npm explore npm -g -- npm install node-gyp@latest`
967. `npm explore npm -g -- npm explore npm-lifecycle -- npm install node-gyp@latest`
978. If the _acid test_ still does _not_ pass then...
989. Add a comment to https://github.com/nodejs/node-gyp/issues/1927 so we can improve.
99
100Lessons learned from:
101* https://github.com/nodejs/node-gyp/issues/1779
102* https://github.com/nodejs/node-gyp/issues/1861
103* https://github.com/nodejs/node-gyp/issues/1927 and elsewhere
104* Thanks to @rrrix for discovering Solution 3
Note: See TracBrowser for help on using the repository browser.