EACCES: Permission Denied Error
Fix 'EACCES: permission denied' errors in Node.js and Linux. Learn how to fix file permission, port binding, and npm global install issues.
What Does This Error Mean?
The EACCES error means the application does not have sufficient permissions to access a file, directory, or resource. This is a file system or operating system permission error, not an HTTP 403.
Common Causes
Trying to bind to a privileged port (below 1024) without root
npm global install without sudo on Linux/macOS
File or directory permissions set too restrictively
Running Node.js as a different user than the file owner
SELinux or AppArmor blocking access
Read-only file system (e.g., container without write permissions)
How to Fix It
Use ports above 1024 and proxy
Run your app on a high port and use Nginx as a reverse proxy on port 80/443.
# Run app on port 3000 instead of 80
PORT=3000 node app.js
# Nginx reverse proxy to forward port 80 to 3000
server {
listen 80;
location / {
proxy_pass http://localhost:3000;
}
}Fix npm global permissions
Configure npm to use a local directory for global packages instead of /usr.
# Option 1: Change npm prefix mkdir ~/.npm-global npm config set prefix "~/.npm-global" echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.bashrc # Option 2: Use nvm (recommended) # nvm manages Node.js without sudo
Fix file permissions
Use chmod to grant appropriate file permissions.
# Make file readable and writable by owner chmod 644 file.txt # Make directory executable (traversable) chmod 755 directory # Change ownership sudo chown -R $(whoami) /path/to/project
Related Tools
Use these tools to debug and fix this error:
Related Errors
Other common errors in this category:
401 Unauthorized Error
Learn what a 401 Unauthorized error means, common causes, and how to fix authentication failures in your web applications.
403 Forbidden Error
Learn what 403 Forbidden means, how it differs from 401, and how to fix access denied errors in your applications.
404 Not Found Error
Learn what 404 Not Found means, common causes, and how to fix broken links and missing resources on your website or API.
429 Too Many Requests Error
Learn what 429 Too Many Requests means, how rate limiting works, and how to handle or avoid hitting API rate limits.