Using Express on OS X Lion, installing npm v1.1.1 with Node v0.6.1 raises permission errors. Running as admin doesn’t overcome it. Example:
$ sudo curl -o fetch_npm.sh && sh fetch_npm.sh
Tar utility at: /usr/bin/tar
Error: Unable to create folder /usr/local/lib/npmpack
How do I resolve this?
I was struggling with a similar issue on my Mac OS X Lion setup. I discovered that the root cause was the permissions on /usr/local. By adjusting the ownership of that directory to my user, I managed to overcome the installation hurdles. I used the command sudo chown -R $(whoami) /usr/local to ensure that I had the right to create new directories and modify files in that space. This solution has worked for me consistently, and it improved overall permissions management when working with node and npm.
During a similar situation with npm installation on Mac OS X Lion, I discovered that changing the install prefix to a location your user controls provided a reliable solution. By setting npm’s prefix to a directory in your home folder, you eliminate the need for escalated privileges. This adjustment circumvents the permission error by avoiding system directories entirely. I configured the prefix using npm config set prefix, and after updating the PATH accordingly, the installation proceeded smoothly without further permission issues.
i fixed it by manually making the missing folder and setting its owner. i ran sudo mkdir -p /usr/local/lib/npmpack and sudo chown -R $(whoami) /usr/local/lib/npmpack. this cleared the permission issue for me, hope it helps.
I eventually resolved a similar npm installation issue by switching to an alternative installation method that sidesteps global directory permission problems. Instead of manually tinkering with permissions, I installed Node and npm via a version manager. Using nvm allowed me to maintain a local setup in my home directory and completely avoided modifications in /usr/local. This approach not only solved the immediate permission errors but also made it easier to switch among different versions in the future. It proved to be a more flexible and safer solution overall.