Software⏱️ 2 min read📅 2026-05-31

How to Fix: Error: EACCES: permission denied

Learn how to fix: Error: EACCES: permission denied.

Quick Answer: Try checking your system settings or restarting.

The 'Error: EACCES: permission denied' error occurs when the system cannot grant the required permissions to access a file or directory. In this case, it's likely due to the lack of write access to the npm cache or the global package directory.

🛑 Root Causes of the Error

  • Insufficient write permissions in the npm cache directory.
  • Lack of access to the global package directory.

🚀 How to Resolve This Issue

Method 1: Changing the npm Cache Directory

  1. Step 1: Run the command `npm config set cache C: pm-cache` (for Windows) or `npm config set cache ~/.npmcache` (for Linux/Mac). This will change the default npm cache directory.

Method 2: Running as Root

  1. Step 1: Run the command `sudo npm install lodash` (for Linux/Mac) or `npx npm install lodash` (for Windows). This will install the package with elevated privileges.

✨ Wrapping Up

By following these methods, you should be able to resolve the 'Error: EACCES: permission denied' issue and successfully install packages.

Did this fix your problem?

If not, try searching for specific error codes.

🔍 Search Error Database

❓ Frequently Asked Questions