To fix missing write access in mac to the /usr/local/lib/node_modules folder on Mac, we’ve to set the folder’s owner to the current user.
For instance, we run
sudo chown -R $USER ~/.npm
sudo chown -R $USER /usr/lib/node_modules
sudo chown -R $USER /usr/local/lib/node_modules
to run chown to set the owner of the ~/.npm, /usr/lib/node_modules and the /usr/local/lib/node_modules folders to the current user.