Tag Archives: NPM Error

[Solved] NPM Error: gyp: No Xcode or CLT version detected!

question

Recently, when using npm to install modules in macOS Catalina, the following errors often occur:


> 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 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.3.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/yangjian/Documents/temp/test001/node_modules/fsevents
gyp ERR! node -v v12.13.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok 
  • Screenshot below

1

solution

1. Try to fix it with the following command

$ xcode-select --install

The system prompts the following information:

xcode-select: error: command line tools are already installed, use "Software Update" to install updates

In fact, there is no so-called “Software Update” to update

2. Correct posture

At a loss, I found the following solutions:

$ sudo rm -rf $(xcode-select -print-path)
$ xcode-select --install

[Solved] NPM Awalys Error: unable to verify the first certificate

Today, NPM install always reports an error: unable to verify the first certificate. After checking, it is found that

As of February 27, 2014, npm no longer supports its self-signed certificates. 

On February 27, 2014, NPM no longer supported self signed certificates

Because NPM install follows the HTTPS protocol, it needs to be guaranteed by digital certificates

Solution 1:

Cancel SSL validation: NPM config set strict SSL false

If not, replace the NPM source with a domestic image:
NPM config set registry   http://registry.cnpmjs.org/
npm config set registry   http://registry.npm.taobao.org/

Solution 2:

Upgrade: NPM install NPM – G — Ca = null
or NPM config set CA = “”

Recommended usage 1