You are running sudo so it wants the password for the user currently logged in. The expectation is that that user has admin rights in which case the npm command will run. If the user doesn’t have access, it won’t run…
This is nothing to do with OH - just your local machine.
I would suggest a search on Google for something like “mac osx sudo not working” - there could be many things stopping it working and you’ll find many posts on Mac forums…
What’s the actual error you get? Is it “Sorry, try again”? Do you have a password set for the user you’re using? If you type sudo ls do you have the same problem?