Assuming the OSX Node Installer was used with your current user as the medium,
the root of the problem seems to stem from incorrect ownership of the node_modules
directory (not so much the /usr/local directory).
$ ls -l /usr/local/libThis will show that the ownership belongs to user 24561 which was probably assigned
by the node installer. Hence, issuing npm install commands with sudo essentially override
and prevent the EACCESS error. However, we still tend to see additional access errors with
other npm moddules such as yeoman when they try to install dependency packages.
Performing the following command should fix the issue:
$ chown -R $USER /usr/local/lib/node_modulesHowever, keep in mind that existing cached modules (if they were installed via sudo) would still
have access problems. As such clear the cache one final time with sudo:
$ sudo npm cache clearFYI: The npm cache is stored in the $USER/.npm directory.
To speed up npm:
$ npm set progress=falseUse NVM: https://github.com/creationix/nvm