Why does browserify need sudo permission for local installs?

When installing browserify locally, why does it require administrator privileges?

With broswerify listed as a dependency in my local package.json, a simple npm install sometimes yields an EACCESS error:

npm ERR! Error: EACCES, mkdir '/Users/user/.npm/browserify/8.1.3'
npm ERR!  { [Error: EACCES, mkdir '/Users/user/.npm/browserify/8.1.3']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/Users/user/.npm/browserify/8.1.3',
npm ERR!   parent: 'my-app' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

Obviously I can use sudo to circumvent the issue, but why should I have to?

Some most likely at some point along the way you installed something with sudo npm. You never have to do that. However, once you've done it, you may have to use sudo npm cache clean or sudo rm -rf /Users/user/.npm to get back to the normal state, then going forward no more sudos ever. This is entirely about filesystem permissions and has zero to do directly with npm or browserify.

Based on the details in your comments specifically run ls -ld /Users/user/.npm/browserify because the problem is when npm tries to mkdir within that, meaning that directory is probably not writeable for user.