Permission Errors
Resolve npm permission errors on macOS and Linux. Fix EACCES errors when installing or running Memoria.
The Problem
You see 'EACCES: permission denied' or similar errors when running npm or Memoria.
Common Causes
- npm global directory has wrong permissions
- Using sudo to install packages (not recommended)
- System npm installation with restricted access
Solutions
Fix npm Permissions (Recommended)
Change npm's default directory to a user-owned location.
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
# Add to ~/.zshrc or ~/.bashrc
export PATH=~/.npm-global/bin:$PATH
source ~/.zshrcUse nvm
Node Version Manager handles permissions automatically.
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.0/install.sh | bash
nvm install 20
nvm use 20Avoid sudo with npm
Never use 'sudo npm install'. This creates permission issues. Use one of the above solutions instead.