LoginSignup
0
0

More than 1 year has passed since last update.

M1 MacでのZeroMQ (Node.js) 導入

Last updated at Posted at 2021-05-12

フロントエンドの開発をやっている中で、既存のプロジェクトをクローンしてきた時に問題が起こりました。 yarn したら途中でエラーになる。どうやら zmq ライブラリがコンパイルできていないようです。M1 Macに変えたばかりなので「もしかしてzmqはM1対応してないのかな〜」とも思いましたが、もしそうだとしたらお手上げなので地道に調べることにしました。

結論

事前に依存ライブラリをインストールする!

エラーメッセージ

エラーメッセージは次の通りです。

error /Users/{myName}/develop/vue/o-GreenCheck/frontend/node_modules/zeromq: Command failed.
(略)
Building libzmq...
/Users/{myName}/develop/vue/o-GreenCheck/frontend/node_modules/zeromq/build/Release/../../script/build.sh: line 60: cmake: command not found
make: *** [libzmq/lib] Error 127
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/{myName}/.anyenv/envs/nodenv/versions/14.16.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 20.4.0
gyp ERR! command "/Users/{myName}/.anyenv/envs/nodenv/versions/14.16.1/bin/node" "/Users/{myName}/.anyenv/envs/nodenv/versions/14.16.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/{myName}/develop/vue/o-GreenCheck/frontend/node_modules/zeromq

対策

ZeroMQ.jsのリポジトリを見ると事前にインストールしておかなければならないものがあるようです。上のエラーではcmake: command not foundと出ているのでインストールします。

brew install cmake
(略)
==> Summary
🍺  /opt/homebrew/Cellar/cmake/3.20.2: 6,468 files, 67.5MB

もう一度yarnしてみると、、、

✨  Done in 88.35s.

成功しました!

参考

C++初心者がMacでCMakeを利用してみる - Qiita

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0