miseでnodeインストールが失敗したときの解決方法
miseでNode14をインストールしようとしたら失敗しました。公式ドキュメントに対応が載っていたので紹介します。
起きた問題
いつものようにmise use
でインストールしようとしたら出ました。
mise use node@14.15
まず1つ目がdistutils
のエラー。
ModuleNotFoundError: No module named 'distutils'
ModuleNotFoundError
の方はPythonのライブラリが足らんぞというやつです。Python(3.9以下)も必要なので併せてインストールしました。
brew install python-setuptoolsmise use python@3.9
ただこれだけでは解決できませんでした。まだエラーが出ます。
make: *** [node] Error 2mise ERROR Failed to install tool: node@14.15
node@14.15: 0: failed to install core:node@14.15.5 1: sh exited with non-zero status: exit code 2
Location: src/cmd.rs:479
Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.Run with RUST_BACKTRACE=full to include source snippets.mise ERROR Run with --verbose or MISE_VERBOSE=1 for more informationmise mise 2025.8.20 by @jdx – install ⠤ 25s
原因
公式ドキュメントを漁ると、Tips & Tricksに次のように書いてありました。
If you have a need to run tools as x86_64 on Apple Silicon, this can be done with mise however you’ll currently need to use the x86_64 version of mise itself. A common reason for doing this is to support compiling node <=14.
node14以下だと、Apple SiliconだとRosetta問題のため 別のmiseが必要 なのです。
対応
まずはx86_64版のmiseをインストールします。このとき、もともと使っていたmiseはそのままでOKです。アンインストール不要です。
curl https://mise.run | MISE_INSTALL_PATH=~/.local/bin/mise-x64 MISE_INSTALL_ARCH=x64 sh
MISE_INSTALL_PATH
のところは各自パスが通っている所を書きます。
バージョンが表示されればOKです。
mise-x64 --version
最初にインストールしたかったやつをmise-x64
の方を使ってインストールしましょう。
mise-x64 use node@14.15
もともとのmiseはどうするの?
前述のとおりアンインストール不要です。普段はmise
を使い、Rosetta問題があるときだけmise-x64
を使いましょう。
今回の問題、ちゃんとエラーメッセージをメモってなくてクリップボード突っ込んでたものを掘り起こしただけです。ちょっと雑ですが備忘録として残しました。
miseなのにインストールがスムーズにいかないなんて……、とビビりましたが一件落着です。