Jee*_*ena 320 terminal node.js npm node-gyp macos-catalina
每次我尝试npm install。我收到以下错误。我如何解决它?
gyp: No Xcode or CLT version detected!
Run Code Online (Sandbox Code Playgroud)
我在node -v ? v8.8.0&npm -v ? v6.11.3
我尝试在 VSCode 终端和 iTerm 上运行它,但最终都出现了相同的错误。(两者都更新到最新版本)。我所做的唯一新事情是将我的 macOS 更新到最新版本(今天是 Catalina 10.15.3)。
$ 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
Run Code Online (Sandbox Code Playgroud)
mPr*_*inC 525
即使你已经安装了它们(我的情况),但是通过升级到 Catalina(10.15.*)你会得到这个错误(我的情况 :))。
因此,简单地安装无济于事,因为您将收到它们已安装的错误。
因此,您需要再次卸载并安装(需要大量重新下载)它们:
xcode-select --print-path
# in my case /Library/Developer/CommandLineTools
# the next line deletes the path returned by the command above
sudo rm -rf $(xcode-select --print-path)
# install them (again) if you don't get a default installation prompt
xcode-select --install
Run Code Online (Sandbox Code Playgroud)
注意:
归功于:gyp:macOS Catalina 未检测到 Xcode 或 CLT 版本
小智 104
这对我使用 macOS Catalina 版本 10.15.5 有效:
$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer
$ sudo xcode-select --switch /Library/Developer/CommandLineTools
...
$ sudo xcode-select --reset
...
Run Code Online (Sandbox Code Playgroud)
现在应该可以访问 xcode cli 工具了。无需重新安装任何东西。
cho*_*hoc 33
我想,到目前为止,您可能已经尝试了多种解决方案,但是如果这些解决方案都对您不起作用,请不要担心 - 我明白了。:)
非工作解决方案:
xcode-select --install对我不起作用(macOS Catalina 10.15.7),因为它显示了一个软件更新对话框,上面写着Can't install the software because it is currently not available from the Software Update Server.sudo xcode-select --reset 也没有为我做的伎俩。工作解决方案:
这是对我有用的方法,即手动使用软件更新重新安装 Xcode 命令行工具。
softwareupdate -lsudo touch /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progresssoftwareupdate -l再次运行验证该列表现在是否包含提到的命令行工具。Software Update。启动Software Update.
sudo rm /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress。Ehs*_*dar 24
试试这些命令:
sudo rm -rf $(xcode-select -print-path)
xcode-select --install
Run Code Online (Sandbox Code Playgroud)
小智 13
我重新安装了命令行工具。
您需要找到安装目录。
xcode-select --print-path
Run Code Online (Sandbox Code Playgroud)
删除现有安装:
sudo rm -r -f /Library/Developer/CommandLineTools
Run Code Online (Sandbox Code Playgroud)
通过运行安装:
xcode-select --install
Run Code Online (Sandbox Code Playgroud)
Pre*_*epa 10
这对我有用
sudo xcode-select --reset
Run Code Online (Sandbox Code Playgroud)
大多数情况下,当有新的操作系统更新发生时,就会发生这种情况。但我找到了解决这个问题的方法。您需要按照以下步骤来解决。
通过删除以前安装的版本来重新安装命令行工具。
step1:首先获取已安装的命令行工具的位置
xcode-select --print-path
Run Code Online (Sandbox Code Playgroud)
上述命令的结果 /Library/Developer/CommandLineTools
步骤2:删除文件夹
sudo rm -rf /Library/Developer/CommandLineTools
Run Code Online (Sandbox Code Playgroud)
步骤3 - 再次安装
xcode-select --install
Run Code Online (Sandbox Code Playgroud)
重新安装命令行开发工具后,当您从命令行运行任何yarn或npm命令时,gyp:未检测到Xcode或CLT版本错误消息应该会消失。
如果您的 Mac 已升级到macOS Catalina (10.15),则需要通过运行安装 XCode 命令行工具xcode-select --install。或者,如果您已经安装了完整的 Xcode,您可以在菜单下找到它们Xcode ? Open Developer Tool ? More Developer Tools。
| 归档时间: |
|
| 查看次数: |
103388 次 |
| 最近记录: |