簡體   English   中英

無法在 Mac OS Catalina 上安裝 npm 包 (fsevents)

[英]Cannot install npm package (fsevents) on Mac OS Catalina

當我運行npm install express --save這個命令時,我收到一個錯誤。 任何人都可以幫我解決這個問題嗎?

錯誤:

> fsevents@1.2.11 install /Users/delowar/Desktop/ytdl/node_modules/chokidar/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 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:321:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.2.0
gyp ERR! command "/usr/local/Cellar/node/13.7.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/delowar/Desktop/ytdl/node_modules/chokidar/node_modules/fsevents
gyp ERR! node -v v13.7.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok

> fsevents@1.2.11 install /Users/delowar/Desktop/ytdl/node_modules/jest-haste-map/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 (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack     at ChildProcess.emit (events.js:321:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.2.0
gyp ERR! command "/usr/local/Cellar/node/13.7.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/delowar/Desktop/ytdl/node_modules/jest-haste-map/node_modules/fsevents
gyp ERR! node -v v13.7.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/chokidar/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
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/jest-haste-map/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

截屏: 在此處輸入圖片說明

問題通過重新安裝 xcode 命令行工具解決。

打開終端並粘貼這些代碼:

sudo rm -rf /Library/Developer/CommandLineTools

然后

xcode-select --install

注意: - 小心使用rm命令

我不喜歡使用 rm -rf 命令,因此當您使用“垃圾”公式安裝 brew 時,您可以在終端上執行的替代選項是:

trash Library/Developer/CommandLineTools

進而

xcode-select --install

如果你沒有安裝垃圾,那么你可以在你的終端上進行: https : //formulae.brew.sh/formula/trash

brew install trash

對我來說,上面的說明不起作用。 所以,我遇到了一個不同的解決方案:

> xcode-select -print-path
/Library/Developer/CommandLineTools
> sudo xcode-select --reset
> xcode-select -print-path
/Applications/Xcode.app/Contents/Developer

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM