[解決策] mac:スタックエラー: `gyp`が終了コードで失敗しました:1



Mac Stack Error



1.問題の説明

npmインストール中にエラーが報告され、さまざまなオンラインアンインストールおよび再インストールnode-gypメソッドは役に立ちませんでしたが、問題の原因が見つかりませんでした。

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:305:16) gyp ERR! stack at emitTwo (events.js:106:13) gyp ERR! stack at ChildProcess.emit (events.js:191:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12) gyp ERR! System Darwin 16.0.0 gyp ERR! command '/usr/local/Cellar/node/8.1.3/bin/node' '/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js' 'rebuild' gyp ERR! cwd /Users/project/node_modules/ckmeans gyp ERR! node -v vxx gyp ERR! node-gyp -v vxxx gyp ERR! not ok

2.理由の推測

gypmakefileに似たコンパイルツールです|このコマンドは主にC++ of、nodeに統合されてnode-gypと呼ばれます。



npmソースコードが配布されますnpm installソースコードをプルしてローカルでコンパイルする場合、Cやなどの他の言語がソースコードで使用されることは避けられません。 C++なので、コンパイルするときは、node-gypなどの他の言語のコンパイルツールが必要ですが、これらのコンパイルツールは、実際には、さまざまなシステムのさまざまなシステムのコンパイルツールに依存しています。たとえば、Macでは、これはnode-gyp実際には依存していますxcode提供されているコンパイラツールは特定の実装に使用されるため、発生した問題はここにあります。xcode問題に加えてxcodeツール管理はxcode-select、リセットするか、インストールまたはリセットする必要があります。

3.解決策

具体的な解決策については、を参照してください schnerd / d3-scale-cluster の問題:



# Do you want sudo to see if your current user has sudo permissions? $ [sudo] xcode-select --install xcode-select: error: command line tools are already installed, use 'Software Update' to install updates # If the prompt is already installed, reset it [sudo] xcode-select --reset

問題が解決しました。