Npm run build Packaging failed

npm run build Packaging failed
production environment:

Operation process:
1. make dev-setup
2. sudo npm install -g handlebars
3. ./build/
4. MODULE=files_versions make build-js-production

The error information is as follows::

ERROR in Cannot find module 'eslint'
Require stack:
- /usr/local/var/www/nextcloud240808/node_modules/eslint-webpack-plugin/dist/getESLint.js
- /usr/local/var/www/nextcloud240808/node_modules/eslint-webpack-plugin/dist/linter.js
- /usr/local/var/www/nextcloud240808/node_modules/eslint-webpack-plugin/dist/index.js
- /usr/local/var/www/nextcloud240808/node_modules/eslint-webpack-plugin/dist/cjs.js
- /usr/local/var/www/nextcloud240808/webpack.common.js
- /usr/local/var/www/nextcloud240808/
- /usr/local/var/www/nextcloud240808/node_modules/webpack-cli/lib/webpack-cli.js
- /usr/local/var/www/nextcloud240808/node_modules/webpack-cli/lib/bootstrap.js
- /usr/local/var/www/nextcloud240808/node_modules/webpack-cli/bin/cli.js
- /usr/local/var/www/nextcloud240808/node_modules/webpack/bin/webpack.js
webpack 5.72.1 compiled with 2 errors in 153224 ms
npm info lifecycle nextcloud@1.0.0~build: Failed to exec build script
npm ERR! errno 1
npm ERR! nextcloud@1.0.0 build: `NODE_ENV=production webpack --progress --config`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the nextcloud@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm timing npm Completed in 156854ms

npm ERR! A complete log of this run can be found in:
npm ERR!     /Applications/MxSrvs/cache/nodejs/_logs/2022-08-09T07_28_32_925Z-debug.log

The same operation process can be successfully executed under nextcloud21, but nextcloud24 will report an error. What is the reason?

The problem has been solved, through upgrade npm@8.11.0 and node@v16.16.0 After that, npm run build is packaged successfully.