miseでnodeインストールが失敗したときの解決方法

miseでNode14をインストールしようとしたら失敗しました。公式ドキュメントに対応が載っていたので紹介します。

起きた問題

いつものようにmise useでインストールしようとしたら出ました。

Terminal window
mise use node@14.15

まず1つ目がdistutilsのエラー。

ModuleNotFoundError: No module named 'distutils'

ModuleNotFoundErrorの方はPythonのライブラリが足らんぞというやつです。Python(3.9以下)も必要なので併せてインストールしました。

Terminal window
brew install python-setuptools
mise use python@3.9

ただこれだけでは解決できませんでした。まだエラーが出ます。

make: *** [node] Error 2
mise 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 information
mise 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です。アンインストール不要です。

Terminal window
curl https://mise.run | MISE_INSTALL_PATH=~/.local/bin/mise-x64 MISE_INSTALL_ARCH=x64 sh

MISE_INSTALL_PATHのところは各自パスが通っている所を書きます。

バージョンが表示されればOKです。

Terminal window
mise-x64 --version

最初にインストールしたかったやつをmise-x64の方を使ってインストールしましょう。

Terminal window
mise-x64 use node@14.15

もともとのmiseはどうするの?

前述のとおりアンインストール不要です。普段はmiseを使い、Rosetta問題があるときだけmise-x64を使いましょう。


今回の問題、ちゃんとエラーメッセージをメモってなくてクリップボード突っ込んでたものを掘り起こしただけです。ちょっと雑ですが備忘録として残しました。

miseなのにインストールがスムーズにいかないなんて……、とビビりましたが一件落着です。