はじめに
npx tailwindcss init
でnpm error could not determine executable to run
エラーが出ました。検索でヒットした他記事と違う解決方法をしたので残します。
エラー内容
$ npx tailwindcss init
npm error could not determine executable to run
npm error A complete log of this run can be found in: /Users/hoge/.npm/_logs/2025-07-05T15_15_49_703Z-debug-0.log
解決方法
どうやらTailwindCSSのバージョンが4系になったことが起因するエラーのようです。
npx tailwindcss がデフォルトで使えない構成になっているようなので、TailwindのCLI版を明示的に追加インストールしましょう。
npm install -D tailwindcss-cli
そして
npx tailwindcss-cli init
これで動きます👍
おわりに
他記事にあるようにバージョン3を指定してしまうシンプルな解決方法もあります。
お好きな方法をお選びください🙌