Due to my reputation, I cannot comment. But I quickly wanted to indicate, as suggested above, in the correct answer:
Alternative method:
npm view webpack version
only the last webpack that is available for download from the registry will be displayed. It will not show the installed version.
(no dependencies)
For public packages: npm list -g --depth=0
For locally installed packages: npm list --depth=0
(with dependencies)
For public packages: npm list -g
For locally installed packages: npm list
Source: Find the version of the installed npm package.
source share