The permission error ‘EACCES permission denied access, /usr/local/lib/node_modules’ occurs in most cases when the user may have installed npm using a Node installer (which is not recommended since npm will be installed in a directory with local permissions which can give rise to permission errors in case npm packages are run globally, see documentation).
To fix the issue, you would need to use nvm to reinstall it (without suppressing npm).
Open up your terminal and run the command below:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
Next invoke the command :
nvm install stable
Which will install the package npm as well as node.js.
There is no need to modify the permissions.
You may want to refer to npm official page for more information.
If you like the content, we would appreciate your support by buying us a coffee. Thank you so much for your visit and support.