NPM cannot install dependencies – Attempt to unlock something which hasn’t been locked

As per photusenigma at: https://github.com/npm/npm/issues/4815

Run these commands in a terminal window (note – DON’T replace the $USER part…thats a linux command to get your user!):

sudo chown -R $USER ~/.npm
sudo chown -R $USER /usr/local/lib/node_modules

…and…if you’re on a mac (like I am), and still see errors after running these commands, then run this last one and you should be good. (Recommend you try testing before you do this one. I don’t like changing the permissions on the ENTIRE /usr/local directory unless it really seems necessary!)

sudo chown -R $USER /usr/local

Leave a Comment