问题
Every time I try to do npm install
I am getting the following error. How do I fix this?
I am on node -v → v8.8.0
& npm -v → v6.11.3
I tried running it on vsCode terminal
and iTerm
, I ended up getting the same error. (both are updated to the latest version). The only new thing I did is update my macOS to the latest version i.e., Catalina 10.15.3
today.
$ npm install Fri Mar 6 17:22:40 2020
> fsevents@1.2.11 install /Users/synapse/Documents/synapsefi-dev-ui/node_modules/watchpack/node_modules/fsevents
> node-gyp rebuild
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/Users/synapse/.nvm/versions/node/v8.8.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:344:16)
gyp ERR! stack at emitTwo (events.js:125:13)
gyp ERR! stack at ChildProcess.emit (events.js:213:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 19.3.0
gyp ERR! command "/Users/synapse/.nvm/versions/node/v8.8.0/bin/node" "/Users/synapse/.nvm/versions/node/v8.8.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/synapse/Documents/synapsefi-dev-ui/node_modules/watchpack/node_modules/fsevents
gyp ERR! node -v v8.8.0
gyp ERR! node-gyp -v v5.0.3
gyp ERR! not ok
npm WARN synapsefi-dev-ui@2.0.20 No repository field.
npm WARN The package country-data is included as both a dev and production dependency.
npm WARN The package react-dropzone is included as both a dev and production dependency.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/watchpack/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
回答1:
In my case, I already had them installed, but by upgrading to Catalina (10.15.*), I got this error. Installing wouldn't help as you will get an error that they are already installed.
Therefore you need to uninstall and install them again:
xcode-select --print-path
# in my case
sudo rm -r -f /Library/Developer/CommandLineTools
xcode-select --install
Credits to: https://medium.com/flawless-app-stories/gyp-no-xcode-or-clt-version-detected-macos-catalina-anansewaa-38b536389e8d
回答2:
Try these commands:
sudo rm -rf $(xcode-select -print-path)
xcode-select --install
回答3:
I was facing the same issue
I reinstalled the command line tools.
You need to find the installation directory.
xcode-select --print-path
Delete the existing installation:
sudo rm -r -f /Library/Developer/CommandLineTools
Install by running:
xcode-select --install
回答4:
you will need to install xcode or command line tools
回答5:
If your Mac has been upgraded to macOS Catalina (10.15)
, you need to install the XCode Command Line Tools by running xcode-select --install
. Alternatively, if you already have the full Xcode installed, you can find them under the menuXcode → Open Developer Tool → More Developer Tools
.
回答6:
Reinstall command-line tools by removing the previously installed version.
step1: First, get the location of the installed command-line tools
xcode-select --print-path
the result of the above command /Library/Developer/CommandLineTools
step2: removed the folder
sudo rm -r -f /Library/Developer/CommandLineTools
step3 - install again
xcode-select --install
With the reinstallation of the command line developer tools the gyp: No Xcode or CLT version detected error message should disappear when you run any yarn or npm commands from the command line.
来源:https://stackoverflow.com/questions/60573595/npm-install-fails-on-node-gyp-rebuild-with-gyp-no-xcode-or-clt-version-detec