Error: Cannot find module ‘node:path’ while running “npm -v” or “npm –version”

My project depends on Node v10.24 and npm v6.9 as it’s a very old project.
I installed node v10.24 and when I run node -v it’s returning 10.24 which is expected

Now when I want to verify npm version using npm -v or npm --version i am getting below error.

enter image description here

Could you please help me on this? I have installed multiple times and tried to restart the system as well, but still stuck here.