I keep getting permission errors when trying to install npm packages on my Mac running Sequoia 15.4. Every time I run the install command, I see this error:
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/package-name
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/package-name'
npm ERR! at Object.mkdirSync (node:fs:1382:3)
npm ERR! at /usr/local/lib/node_modules/npm/lib/utils/move.js:15:8
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
I already tried installing through brew and also attempted to use nvm but still getting the same permission issues. When I try to change npm’s default directory the terminal says the command is not recognized. Has anyone found a working solution for this on newer MacOS versions?
Had this exact problem after upgrading to Sequoia - drove me crazy for weeks. Newer macOS versions have stricter System Integrity Protection that blocks writes to /usr/local/lib/node_modules even with sudo. What finally worked: completely remove the existing Node installation and do a fresh install with nvm. Here’s the key step everyone misses - clear the npm cache first with npm cache clean --force before the nvm setup. Then install Node through nvm and set the default version. Permission errors usually stick around because remnants of the old installation conflict with the new one. After the clean nvm install, I never had to mess with prefix configs or PATH exports. Been running smooth for months now across multiple projects.
Honestly, just nuke everything and start over. Remove node completely with sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*} then reinstall from scratch. Sequoia broke so many dev setups - clean slate’s usually faster than fighting permissions.
Hit this exact nightmare after upgrading to Sequoia - wasted hours on it. macOS changed how it handles system directory permissions, so /usr/local/lib/node_modules gets locked down tight. Skip the prefix changes and nvm reinstalls - there’s an easier fix that actually works. Run which npm and npm config get prefix to see where your npm lives. If it’s pointing to system directories, you’re fighting macOS itself. Just grab the latest Node installer from nodejs.org and run it. This sets up a proper user-space install that plays nice with the new permission system. After installing, check npm config get prefix again - it should point somewhere under your user directory, not /usr/local. No cache clearing or PATH tweaks needed. The trick is working with macOS permissions instead of fighting them.
try running npm config set prefix ~/.npm-global and don’t forget to add export PATH=~/.npm-global/bin:$PATH to your .zshrc. this worked for me after struggling for hours with the same issue. no need for sudo!
Been there. Sequoia wrecked our entire dev team’s setup last quarter.
Everyone’s suggesting local fixes, but you’ll hit this again with the next macOS update or when onboarding new people. I learned this managing 20+ engineers.
Real solution? Move npm operations off your local machine completely. Set up automated workflows that handle package installation and builds in clean environments.
When I need to install packages or run builds, I trigger cloud automation that does everything without touching my local npm setup. No permission fights, no broken environments after system updates.
This saved our team weeks of troubleshooting. New hires get productive immediately instead of spending days fixing local environment issues.
The npm permission dance on Mac is brutal. I’ve watched it destroy entire dev teams during local environment setup.
Sure, changing the npm prefix works, but you’re still stuck with local dependency headaches. Every new team member or system update means the same troubleshooting nightmare all over again.
I gave up fighting local setup issues years ago. Now I run everything through cloud automation. No permission errors, no “works on my machine” BS.
Need to install packages or run builds? I trigger automated workflows that handle it all in a clean environment. Packages install, tests run, results come back - my local machine stays untouched.
Teams love this because everyone gets identical environments. No more debugging npm configs.
You can set this up with Latenode to automate your entire npm workflow in the cloud: https://latenode.com