Published in


How to Fix npm EACCESS Permission Denied Error

The solution…

Photo by Osman Rana on Unsplash

Ever tried installing packages globally and encountered an EACCES permissions error? For instance, running the following command ‘npm install -g expo-cli’ returns you with —

npm ERR! errno -13
npm ERR! Error: EACCES: permission denied… … ….
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
npm ERR! If you believe this might be a permissions issue, please double-check the permissions of the file and its containing directories, or try running the command again as root/Administrator.

The Solution —

  • Reinstall npm with a version manager, OR
  • Do a manual change of npm’s default directory

To download and install the latest version of npm, run the following commands:

npm install -g npm

To manually change npm’s default directory, run the following commands:

mkdir ~/.npm-global

npm config set prefix ‘~/.npm-global’

export PATH=~/.npm-global/bin:$PATH

source ~/.profile


mkdir ~/.npm-global

npm config set prefix ‘~/.npm-global’

echo ‘ export PATH=~/.npm-global/bin:$PATH’ >> ~/.bash_profile

source ~/.bash_profile

→Run these commands to check for the installed versions:

npm -v
node -v

Photo by Rafael De Nadai on Unsplash

We curate and disseminate outstanding articles from diverse domains and disciplines to create fusion and synergy.

Recommended from Medium

How to convert a PowerPoint PPTX to a PNG Array in Node.JS

Find out null, undefined andempty string in Javascript

LeetCode problem #395: Longest substring with at least K repeating characters(JavaScript)

Intro to Sets in Javascript

How to REACT

React Do’s and Don’ts

14 Days Study Plan to Crack Algo

How to Convert DOCX to HTML in Node.JS

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


writer | contemporary | digital nomad | world citizen | founder | Add me on Session? Leave a comment on the post with your Session ID

More from Medium

5 ways to deal with distractions

CRACK MAN VS CREDIT MAN | Who Makes More Money

Local Opportunities For Artists — How To Make Money Offline

3 Names You May Know Who Leveraged an Uncommon Financial Strategy to Live Their Dreams