How to get rid of this error for upgrading to V5

System Information
  • Strapi Version: 4.25.7
  • Operating System: windows 11
  • Database: mysql
  • Node Version: 18.20.1
  • NPM Version: 10.8.2
  • Yarn Version:

when i try to upgrade strapi for v5
npx @strapi/upgrade major
I got this trouble continuesly.

node:internal/modules/cjs/loader:1143
throw err;
^

Error: Cannot find module ‘esbuild’

Please help

Thanks

Were you able to resolve this. I have the same issue?

Yes.
i install esbuild (npm i esbuild)
but not only in strapi app folder.
i installed esbuild package in %app_data% local/npm_cache folder as well as error stack shows.

You installed esbuild not only in the Strapi app folder but also in the %appdata%/local/npm_cache folder, as indicated by the error stack. Try cleaning the npm cache and ensuring esbuild is installed in the correct project directory.