@wordpress/scripts 28 requires WordPress 6.6 or higher as explained in this thread: https://github.com/WordPress/gutenberg/issues/62202 so if you are using the currently latest WP 6.5 the easiest way to fix it is to install v27 of the scripts.
npm install --save-dev @wordpress/scripts@~27 --legacy-peer-deps