エラー内容
下記コマンドを入力したらエラーが起きた
コマンドの内容
% npm create vite@latest
> npx
> 'create-vite'
│
◇ Project name:
│ type-class
│
◇ Select a framework:
│ React
│
◇ Select a variant:
│ TypeScript
│
◇ Install with npm and start now?
│ Yes
エラーの内容
You are using Node.js 22.9.0. Vite requires Node.js version 20.19+ or 22.12+. Please upgrade your Node.js version.
file:///Users/ディレクトリ/type-class/node_modules/rolldown/dist/shared/binding-Dh6LYCIB.mjs:509
const error = /* @__PURE__ */ new Error("Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.");
Node.js v22.9.0
npm error code 1
npm error path /Users/ディレクトリ
npm error command failed
npm error command sh -c 'create-vite'
# 解消方法
22.12+と書いているからバージョンを上げたらいいのかな?と思い、以下のコマンドを打った
% nodebrew install-binary v22.12.0
% nodebrew use v22.12.0
use v22.12.0
さいど同じコマンドを打ったらできた