エラー内容
下記コマンドでエラーが起きた
npm create vite@latest
エラー内容はこちら
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: 'create-vite@9.0.7',
npm WARN EBADENGINE required: { node: '^20.19.0 || >=22.12.0' },
npm WARN EBADENGINE current: { node: 'v20.10.0', npm: '10.2.3' }
npm WARN EBADENGINE }
~~~~~~~~~~~~
SyntaxError: The requested module 'node:util' does not provide an export named 'styleText'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:132:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:214:5)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
at async loadESM (node:internal/process/esm_loader:34:7)
at async handleMainPromise (node:internal/modules/run_main:113:12)
Node.js v20.10.0
npm notice
npm notice New major version of npm available! 10.2.3 -> 11.17.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v11.17.0
npm notice Run npm install -g npm@11.17.0 to update!
npm notice
npm ERR! code 1
npm ERR! path /Users/tsunodayuki/study
npm ERR! command failed
npm ERR! command sh -c create-vite
解決方法
npm notice New major version of npm available! 10.2.3 -> 11.17.0なので、
その下に書いているコマンドを実行したらOK
npm install -g npm@11.17.0
補足
下記のようなエラーが出たらこちらの記事をご確認ください
npm ERR! code EBADENGINE
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node/npm: npm@11.17.0
npm ERR! notsup Not compatible with your version of node/npm: npm@11.17.0
npm ERR! notsup Required: {"node":"^20.17.0 || >=22.9.0"}
npm ERR! notsup Actual: {"npm":"10.2.3","node":"v20.10.0"}